我想要做的是更新或插入表中的行。在我的情况下,更新看起来像这样:update或创建laravel中的增量
\DB::table('inventories')->where('product_code',$product_code)->increment('stock_current_quantity',$quantity);
我不想使用if语句。我真正想要的是将增量整合到以下语句中,以便更新为上述语句。
\App\Inventory::updateOrCreate(['product_code' => $product_code], ['stock_current_quantity'=>$quantity]);
在此先感谢!
为什么你不使用雄辩?雄辩模型非常简单。 –