mardi 14 avril 2020

How can i deduct a single value from a column with multiple rows in laravel

hope u guys are doing well in this lockdown and hardtimes..pls i need some help

i have a colume with many rows with values in this order

safeamount

  • 500
  • 600
  • 200

I want to be able deduct a single value from this field...for example, i want to deduct 150 from this column so if the total is this column is 1,300 after my query i want to have 1,150 as the total of the column

i tried

$mar1bags = 150;
$availablebefore =  DB::table('safemoney')->decrement('safeamount', $mar1bags);

but this gives me wrong values... please if someone can help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire