I'm trying to create a method that will return the amount of minutes since the last insertion in the database. The way I did it was this one, but this one giving error:
$now = Carbon::now();
$minutes = LusLeadUpdateStatus::select('created_at')
->orderby ('created_at', 'desc')
->get()
->toArray();
$totalDuration = $minutes->diffInMinutes($now);
(// o erro é aqui, pois dando print_r($minutes) o resultado é algo assim:
[0] => Array
(
[created_at] => 2018-08-30 14:55:35
)
[1] => Array
(
[created_at] => 2018-08-30 14:55:20
)
)
The created_at field is where I have the insert in the database, and it is in the date / time format.