pc-buddy
asked on
Laravel format Error
Hi,
my code worked fine but has suddenly died
I get this error
Call to a member function format() on a non-object
Please help thanks
my code worked fine but has suddenly died
{{ str_limit($child['date_of_birth']->format('d-m-Y'), $limit = 10, $end = '') }}
I get this error
Call to a member function format() on a non-object
Please help thanks
ASKER
ya it works fine without the format option added, the date if just displayed in the wrong order so i'm trying to format it correctly.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help, got me to the fix
To get started, use something like Laravel dd() to print out the contents of $child. The code expects to find an object in the $child array at the index named 'date_of_birth'. If that's not an object (of the type that would have a format() method, make your way "upstream" in the code to the place where the $child array is populated.