Reputation: 1645
I'm trying to get the date from a timestamp field in my database, i'm using a timestamp because with date Carbon doesn't add the hours/minutes/seconds in my date, and I need them.
When I try to get the date it works but return a string, and I can't use the Carbon methods with this string, what can I do ? I don't know why it's a string.
Here is what I try to do :
@foreach($disponibilites as $comp)
<span class="badge badge-pill indigo">{{ $comp->date_debut->diffForHuman() }}</span>
@endforeach
Upvotes: 1
Views: 1466
Reputation: 862
add the column name in date attribute in model as the following :
protected $dates = ['date_debut'];
Upvotes: 1