laravel 8 blade get days and hours ago

Solutions on MaxInterview for laravel 8 blade get days and hours ago by the best coders in the world

showing results for - "laravel 8 blade get days and hours ago"
Angelo
14 Nov 2018
1@php($diffInDays = \Carbon\Carbon::parse($user->created_at)->diffInDays())
2
3@php($showDiff = \Carbon\Carbon::parse($user->created_at)->diffForHumans())
4
5@if($diffInDays > 0)
6
7@php($showDiff .= ', '.\Carbon\Carbon::parse($user->created_at)->addDays($diffInDays)->diffInHours().' Hours')
8
9@endif
10
11{{$showDiff}}