Answers for "increment value laravel elequent"

PHP
2

laravel eloquent increment

Customer::find($customer_id)->increment('loyalty_points');
  
  
// increment by 20 
  Customer::find($customer_id)->increment('loyalty_points',20);
Posted by: Guest on May-25-2021
1

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

Browse Popular Code Answers by Language