view.php
Código :
<form role="form" method="POST" name="forminformation" action="{{ url('/community') }}"> {{ csrf_field() }} <input class="with-gap" name="community_fortaleza" type="checkbox" id="test1" value="opcion1"/> <label for="test1">opcion1</label> <input class="with-gap" name="community_fortaleza" type="checkbox" id="test2" value="opcion2"/> <label for="test2">opcion2</label> <input class="with-gap" name="community_fortaleza" type="checkbox" id="test3" value=opcion3"/> <label for="test3">opcion3</label> <textarea id="textarea1" name="community_fortalezaotro" class="materialize-textarea" length="500"></textarea><label for="textarea1">Otro (especifique)</label> <button class="btn waves-effect waves-light" onclick="pregunta()" name="action">Guardar</button> </form>
route.php
Código :
Route::post('/community','CommunityController@store', function () { return view('community'); });
modelo.php
Código :
class Community extends Model { /** * * * @var array create migration variable. */ protected $fillable = [ $community_fortaleza= implode(";", $community_fortaleza); 'community_fortaleza', 'community_fortalezaotro', ]; }
controller.php
Código :
public function store(Request $request) { // $this->validate($request, [ 'community_fortaleza' => 'required', 'community_fortalezaotro' => 'nullable|max:500', ]); $Community = new Community(); $Community->community_fortaleza = $request->community_fortaleza; $Community->community_fortalezaotro = $request->community_fortalezaotro; $Community->save(); return view('home'); }
Este seria mi código, de nuevo muchas gracias y que tengan un excelente día.