Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Increment & Decrement in Laravel 5

by
Category:laravel
mysql laravel
Increment & Decrement in Laravel 5

If you want to increment or decrement opration using update() method of laravel query builder then you also do that, i am showing you how to increment and decrement value of column in table by using increment(), and decrement().

Both of these methods accept at least one argument the column to modify. A second argument may optionally.

DB::table('tbl_order')->increment('amount');
DB::table('tbl_order')->increment('amount', 150);
DB::table('tbl_order')->decrement('amount');
DB::table('tbl_order')->decrement('amount', 200);

You may also specify additional columns to update during the operation using array

DB::table('tbl_order')->increment('amount', 120, ['product_name' => 'ball']);

0 Comments


Html code work in comment box


Related Post