I'm new to Laravel 5.1, I don't know what I'm doing wrong when I'm retrieving a date string from the database and trying to show it on blade form.
It doesn't work, the date from de database does not appear on the Form::date
.
I know I'm missing something crucial here :)
Here is the view code:
<div class="col-sm-6">
<div class="form-group">
{!! Form::label('birth_date', trans('userapps/userapps.birth_date'))!!}
{!! Form::date('birth_date', Input::old('birth_date'), array('class' => 'form-control input-lg'))!!}
@if ($errors->has('birth_date')) <p class="help-block">{{ $errors->first('birth_date') }}</p> @endif
</div>
</div>
Here is the controller code:
public function edit($id)
{
//show all saved values for editing
$userapp = UserApplication::findOrFail($id);
$birth_date = DateTime::createFromFormat('d/m/Y', $userapp->birth_date)->format('d/m/Y');
$data = array('birth_date' => $birth_date, 'userapp' => $userapp);
return view('admin/userapps/edit')->with($data);
}
Thanks in advance.