Reputation: 971
I would like to change the date of birth for a field, however when I click on the button edit, the value of the date of birth is empty.
Here is an example
index.blade
edit.blade
The value is empty...
I have tried this:
<fieldset class="form-group">
<label for="form-group-input-1">Date naissance</label>
<input type="date" name="date_naissance" class="form-control" id="form-group-input-1" value="{{$eleves->date_naissance}}">
</fieldset>
Thank you!
Upvotes: 0
Views: 1205
Reputation: 1888
That's quite simple. your value date should have a format... And the edit will work if you have it on a form, ect...
value="{{$eleves->date_naissance->format('Y-m-d')}}"
change this:
<input type="date" name="date_naissance" class="form-control" id="form-group-input-1" value="{{$eleves->date_naissance}}">
</fieldset>
to this:
<input type="date" name="date_naissance" class="form-control" id="form-group-input-1" value="{{$eleves->date_naissance->format('Y-m-d')}}">
</fieldset>
Test it and let me know.
Upvotes: 3