I need your help with something. I cant find to work this one out. I think it should be really simple, but it has kept me busy for hours.
{{Form::date('age', $data[0]->age)}}
When I use the form::date function I let a user select a birthday. After selecting the information is saved to a database in the following format ("Y-m-d"), this works perfectly.
If the user wants to edit the date of birth, it shows it as ("d-m-Y"), how can I show this as ("Y-m-d")? I have been searching online for hours, have tried it with carbon, with date_format and a lot more, nothing seems to work.
What am I doing wrong here? I am using laravel 5.2
Thank you for the help.
UPDATE
The query to get the information from the Mysql panel:
$userId = auth()->user()->id;
$data = Setting::where('user_id', '=', $userId)->first();
return view('pages_user.mysettings')->with('data', $data);
The model:
protected $dates = ['age'];
protected $table = 'date_userinfo';
The input box
{{ Form::date('age', $data->age->format('Y-m-d')) }}
$data[0]->age?