In the controller dump out what is being sent when it's not being filled in.
dd($request->all());
Does it have?
'date_of_visitation' => ''
I have a form with several date inputs, majority of them are nullable fields, receiving this error when the field is left blank
Invalid datetime format: 1292 Incorrect datetime value:
form looks like this:
<div class="form-group">
{!! Form:: label('date_of_visitation','Date:' ) !!}
{!! Form:: input('date', 'date_of_visitation', null, ['class' => 'form-control', 'placeholder' => 'MM/DD/YYYY']) !!}
</div>
Migration looks like this:
$table->timestamp('date_of_visitation')->nullable();
when this was in Sqlite it worked fine, now in mysql it throws that error Any Suggestions??
Yeah so it prob needs this in the Model
use Carbon\Carbon;
public function setDateOfVisitationAttribute($value)
{
$this->attributes['date_of_visitation'] = !empty($value) ? Carbon::createFromFormat('m/d/Y',$value) : null;
}
Please or to participate in this conversation.