Call to a member function format() on string
I have this code:
'due_date' => $date->format('d/m/Y'),
But it appears this error:
Call to a member function format() on string
Do you know what can be the issue?
The $date shows '2018-07-08 06:30:00'.
How are you getting $date here? Where does it come from?
'due_date' => $date->format('d/m/Y'),
Usually it would be $conference->date->format('d/m/Y'); since it's a property on the conference model.
like
$conference = Conference::find(1);
echo $conference->date->format('d/m/Y');
You must specify the dates values in your model:
protected $dates = [
'date_1',
'date_2'
];
Later you can user Carbon
Please or to participate in this conversation.