When I am trying to use form model binding to refill the edit form , everything works fine except the date input .
After defining a Accessor thing goes OK but i don't want the date format applied to all of my application .
After searching I found Form Model Accessors , But it seems not working for me .
Here is my form .
{!! Form::model($activity , ['method' =>'PATCH' , 'action'=>['Manage\ActivityController@update' , 'club'=>$club , 'activity'=>$activity->id]]) !!}
<div class="form-group">
{!! Form::label('start_at') !!}
{!! Form::input('date' , 'start_at' , null , ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('expired_at') !!}
{!! Form::input('date' , 'expired_at' , null , ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit("submit", ['class' => 'btn btn-primary from-control']) !!}
</div>
{!! Form::close() !!}
Here is my Form Model Accessors .
public function formStartAtAttribute($date)
{
return Carbon::parse($date)->format('Y-m-d');
}
public function formExpiredAtAttribute($date)
{
return Carbon::parse($date)->format('Y-m-d');
}
How can I make the date display correctly ?