0

How can I check if $expiresAt has actually expired, against the $now timestamp?

$expiresAt = Carbon::parse($tokenInstance->expires_at);
$now = Carbon::now();
kege
  • 1

2 Answers2

0

This itself will work:

if($expiresAt < $now){
    echo 'Expired';
}else{
    echo 'No Expired';
}
arun
  • 4,595
  • 5
  • 19
  • 39
0

Don't know if this helps, but the Laravel Query Builder offers a more Eloquent solution:

$query ->whereDate('$expiresAt', '<', date('Y-m-d'));

more here

marco_nz
  • 3
  • 1
  • 9