How to Increment Multiple Column Values in Laravel 10
In this post we will give you information about How to Increment Multiple Column Values in Laravel 10. Hear we will give you detail about How to Increment Multiple Column Values in Laravel 10 And how to use it also give you demo for it if it is necessary.
Before Laravel v9.48.0 you can only increment or decrement single-column values in Laravel but after this v9.48.0 release, you can increment or decrement multiple-column values in Laravel.
Laravel v9.48 introduce incrementEach()
and decrementEach()
to Illuminate/Database/Query/Builder.
You can use those methods to increment or decrement multiple column values. We will use both methods in this article.
How to Increment Multiple Column Values in Laravel 10
Increment Multiple Column Value Example:
DB::table('traffic')->where('slug', 'install-laravel-on-ubuntu')->incrementEach([
'visit' => 1,
'cost' => 5,
]);
How to Decrement Multiple Column Values in Laravel 10
Decrement Multiple Column Value Example:
DB::table('traffic')->where('slug', 'install-laravel-on-ubuntu')->decrementEach([
'visit' => 1,
'cost' => 5,
]);
That’s it.
Thank you for reading Increment Multiple Column Values in Laravel 10, Hope this code and post will helped you for implement How to Increment Multiple Column Values in Laravel 10. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs