How to Decrement Multiple Fields in Laravel
In this lesson, we will see how to decrement multiple fields in Laravel, in the old versions of laravel you could decrement only one field but since version 9.48 you can decrement multiple fields with only one query.
How to decrement multiple fields in Laravel
You can do that using the code below:
Post::find(1)->decrementEach([
'likes' => 1,
'views' => 1
]);