是否有方法在created_at日期字段大于今天(午夜(的表中更新或创建记录?
我有以下样品:
Model::updateOrCreate(
[
'match_id' => $match->id,
// 'created_at' => some query here to match a record created today
]
);
以下是我发现有效的解决方案:
Model::updateOrCreate(
[
'match_id' => $match->id,
'created_at' => Model::where('created_at', '>', DB::raw('CURDATE()'))->first()->created_at ?? null
],
[
'otherColumn' => $value
]
);