如何在Laravel中运行以下查询?
Select column1,column2,column3 from table;
Run Code Online (Sandbox Code Playgroud)
我不想像我们一样检索所有列记录
Select * from table;
Run Code Online (Sandbox Code Playgroud) 我想做的是更新或插入表中的行。就我而言,更新看起来像这样:
\DB::table('inventories')->where('product_code',$product_code)->increment('stock_current_quantity',$quantity);
Run Code Online (Sandbox Code Playgroud)
我不想使用if else语句。我真正想要的是将增量集成到以下语句中,以便按上述语句进行更新。
\App\Inventory::updateOrCreate(['product_code' => $product_code], ['stock_current_quantity'=>$quantity]);
Run Code Online (Sandbox Code Playgroud)
提前致谢!