葵花宝典教程,一个自学编程平台

葵花宝典教程,一个自学编程平台

Laravel DB::table update record

I have this query

 DB::table('product_options')
        ->where('product_id', $id)
        ->where('size', $selected_size)
        ->update(array('stock' => WHAT TO PUT HERE));

In the update part where I've put WHAT TO UPDATE, what should I put here to decrease the number by 1?

DB::table('product_options')
        ->where('product_id', $id)
        ->where('size', $selected_size)
        ->decrement('stock');


第9条葵花宝典
== ==

Copyright www.jennal.cn Rights Reserved葵花宝典教程.鄂icp2022001145号-1

分享:

支付宝

微信