Closed Gzerox closed 10 years ago
ATM i’ve found this solution: on Controller->Edit , by default we search for a model and then pass it to the view My model on the view is $match, so in my case:
$match->date->format('d-m-Y’)
the “format” method will only work if on your model you’ve declared which attribute have to be consider as date: model/Match.php
protected $dates = ['date’];
so in my view from TIMESTAMP -> d-m-Y :
Bootstrap::date('date', '', $match->date->format('d-m-Y'), $errors, [], ['format' => 'DD-MM-YYYY’])
Hi there,
Yes, by default Laravel can't parse date, and format them using Carbon until being directed as to which model items are dates using the $dates array.
protected $dates = ['date'];
By default Bootstrapper has the ability to automatically set the posted value of any item added to the page upon a form submission, in case validation fails, etc. This way, you only ever have to pass the current set value of the item in question, from either the model, or null.
Is everything now sorted?
Just so you are aware, I have created a base application for Laravel, if you want to get any insights: https://github.com/bradcornford/Laravel-Bootstrap-Base/
Thank you brad :+1:
Hi Again sir, I’m unable to get date format working (while loading a value)
edit.blade.php
when the edit page has been loaded, on “Date” Field, i’ve:
on DB this field is a TIMESTAMP, this don’t work event if i try in this way:
or