Answers for "laravel increment column forieng key"

PHP
1

laravel increment column value in update query

DB::table('my_table')
   ->where('rowID', 1)
   ->update([
       'column1' => DB::raw('column1 + 2'),
       'column2' => DB::raw('column2 + 10'),
       'column3' => DB::raw('column3 + 13'),
       'column4' => DB::raw('column4 + 5'),
   ]);
Posted by: Guest on December-31-2021
0

increment laravel

$customer = Customer::find($customer_id);
$loyalty_points = $customer->loyalty_points + 1;
$customer->update(['loyalty_points' => $loyalty_points]);

or

Customer::find($customer_id)->increment('loyalty_points');
Posted by: Guest on July-03-2021

Code answers related to "laravel increment column forieng key"

Browse Popular Code Answers by Language