calin.ionut's avatar

get only trashed older then number of days

Anyone know why this is not working?

Flight::onlyTrashed()->whereDate('deleted_at', '>=', now()->subDays(5)->toDateTimeString())->get();

It returns all the trashed... but I want only the trashed older then 5 days. How can I do that?

1 like
3 replies
Shivamyadav's avatar
Level 20

Your comparision operator is wrong flip it .

Flight::onlyTrashed()
    ->where('deleted_at', '<=', now()->subDays(5))
    ->get();

2 likes

Please or to participate in this conversation.