A "quick tip" lesson. Laravel has a few helper methods to update your Eloquent Model updated_at
timestamp. For example, on the user Model, you have some users, and you want to update just its updated_at
value without touching any other data.
You can use touch()
on the Model, which will update only the updated_at
field.
Since Laravel 9.25, there's a possibility to use touch()
on multiple models with Eloquent query.
Records with an ID bigger than two will be updated, and the result is how many records are updated. In this example, two.
You can also touch a...