I need to get all the rows on my database that meet some criteria. One those criteria is to not be older than 24 hours.
I've been trying different solutions posted on SO but none seem to work.
I've tried all this solutions:
select models that more than 24 hours have passed since their creation in laravel
Retrive records where updated_at is older than created_at with 2 hours in Laravel (eloquent)
Get rows where created date is older than 14 days
I'm getting no error and i can see on the database that I have results. This is how my query looks now:
$token = RefreshToken::where([['refresh', $refreshToken], ['valid', true], ['created_at', '<=', Carbon::now()->subDays(1)->toDateTimeString()]])->first();
Log::debug(($token));
I want to get the first token that has the refresh value that comes from a form, is valid and has been created in less than 24 hours.