Answer the question
In order to leave comments, you need to log in
How to specify that the updated_at field does not change when a query is made through the model?
Good afternoon. There is a task to change the active field in the users table to false if updated_at is more than 3 months old. I settled on this code:
User::where('active', true)
->whereDate('updated_at', '<=', now()->subMonths(3))
->update(['active' => false]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question