I want to set a date
field to NOW()
if it's outdated. Here is the query I'm trying to run without success:
Quiz::('date', '<', DB::raw('NOW()'))->update(['date' => DB::raw('NOW()')])
How do I fix it?
P.S
I don't want to deal with Carbon
, if possible, to avoid the server/DB time difference issues.
Try something like:
DB::table('quizzes')->where(DB::raw('date < NOW()'))->update(['date' => DB::raw('NOW()')]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With