我正在使用Laravel Framework 6.16.0并從字符串創建日期對象,以便我可以將其輸入到我的數據庫中:$transaction_date = Carbon::createFromFormat('Y-m-d', $tradeDate);$filling_Date = Carbon::createFromFormat('Y-m-d H:i:s', $fillingDate, 'UTC');$product = Product::updateOrCreate( [ 'price' => trim($price), 'qty' => $qty, 'companies_id' => $company->id, 'persons_id' => $person->id, 'amount_range' => $owned, 'filling_date' => $filling_Date, 'transaction_date' => $transaction_date, ], []);運行上述查詢時,即使我的產品已經存在,我的產品也不會在數據庫中被發現$filling_Date且不匹配。$transaction_date我猜測,原因是我正在創建一個“新”Carbon 對象。有什么建議如何在數據庫中匹配filling_date和嗎?transaction_date我很感謝你的回復!
- 1 回答
- 0 關注
- 93 瀏覽
添加回答
舉報
0/150
提交
取消