My code is like this :
foreach ($orders as $order)
{
date_default_timezone_set('Asia/Jakarta');
$now_at = date("Y-m-d H:i:s");
$delivered_at = $order->delivered_at->toDateTimeString();
$delivered_after_1d = strtotime("+1 day", strtotime($delivered_at));
$delivered_after_1d = date('Y-m-d H:i:s', $delivered_after_1d);
if($now_at > $delivered_after_1d)
{
...
}
}
It works
But I want change it using laravel. For example use Carbon::now()
. But I'm confused
Is there anyone who can help me?
Note :
delivered_at : data type = datetime
via samuel toh