2
有什么方法可以在使用查询生成器时自动使用时间戳,目前我使用的是CARBON。 这里是我的代码:在Laravel 5.4查询生成器中自动使用时间戳
DB::table('product_in_out')->insert(
['product_id' => $product_id,
'warehouse_id' => $warehouse_id,
'balance_before' => Product::getProductBalanceOf($action_id, $product_id),
'in' => $product_qty,
'out' => '0',
'after_balance' => Product::getProductBalanceOf($action_id, $product_id)+$product_qty,
'action' => 'ProcurementReceipt',
'action_id' => $action_id,
'created_by' => auth()->user()->id,
'updated_by' => auth()->user()->id,
'is_active' => '1',
'created_at' => \Carbon\Carbon::now(), # \Datetime()
'updated_at' => \Carbon\Carbon::now(),# \Datetime() ]
);
我明白了你的观点,所以这意味着自动时间戳只能用于口才? –
@MartneyAcha是的,与查询生成器,你必须手动做 –
好吧谢谢萨加尔 –