I retrieve this date format from my database: 2016-09-05T10:24:13Z
I need get this date and apply a diffForHumans() carbon method directly.
I have a ticket messages chats timeline:
@foreach($ticket->messages as $msg)
<div class="chat-bubble>
<div class="chat-msg">{{ $msg->message }}</div>
<div class="chat-footer">{{ $msg->creation_date }}</div> //here needs carbon diff
</div>
@endforeach
How can I use Carbon in my tickets.blade.php in one code line?
@foreach($ticket->messages as $msg)
<div class="chat-bubble>
<div class="chat-msg">{{ $msg->message }}</div>
<div class="chat-footer">{{ $msg->creation_date->diffForHumans() }}</div> //here needs carbon diff
</div>
@endforeach
You should write this. Hopefully this will solve your problem
@foreach($ticket->messages as $msg)
<div class="chat-bubble>
<div class="chat-msg">{{ $msg->message }}</div>
<div class="chat-footer">{{ $msg->creation_date->diffForHumans() }}</div>
</div>
@endforeach
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.