I created a simple form that sends some data to a mysql database.
When entering name
or email
everything workes fine. Except for the checkboxes. It runs perfekt when all checkboxes are checked, but if not -> i always get this error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'checkbox1' cannot be null
so i got this for creating the form:
{{Form::label('checkboxlabel', 'Agree')}} {{Form::checkbox('checkbox1',1, true)}}
This is my migration file:
Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('email')->unique(); $table->boolean('checkbox1')->nullable();
And this my Controller file:
$user = new User; $user->email= $request->input('email'); $user->checkbox1= $request->input('checkbox1');
Any help on this? Just want some true or false value for checked or not checked. Thx guys!