Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kemped's avatar

Updated at didnt change for 1 day - Query

How can I query data that hasn't change for more than 1 day? I'm not talking one day from today but in all time. It could've been not update for 1 day one month ago for example.

0 likes
1 reply
kalemdzievski's avatar

Use the timestampupdated_at from your model. If you don't have it, add it, since there would be no other way.

Laravel can maintain it for you, once you add them. You read about it here.

After that you can query the data like this:

$models = Model::where('updated_at', '<=', Carbon::now()->subDay()->toDateTimeString())->get();

Please or to participate in this conversation.