1

I have this code in laravel

if ( Carbon::now()->greaterThan($verifyUser->created_a->addDays(1)) )

The error is "Call to a member function addDays() on null"

That code is to check if the user did not verify on time within 24hrs. Thanks

1 Answers1

2

Change this

if ( Carbon::now()->greaterThan($verifyUser->created_a->addDays(1)) )

to

if ( Carbon::now()->greaterThan($verifyUser->created_at->addDays(1)) )

if you are using created_a

then set the in your model

protected $dates = ['created_a'];
FULL STACK DEV
  • 15,207
  • 5
  • 46
  • 66