Answer the question
In order to leave comments, you need to log in
How to write this query in Laravel?
How can a given UPDATE `logs` SET `status`= 1 WHERE `status` = 0 LIMIT 1 query be written to Laravel using a DB facade?
Tried like this DB::table('logs')
->where('status', 0)
->update(['status'=>1])
->first();
But as I understand it, update already returns data and first gets a value with which it cannot work.
Answer the question
In order to leave comments, you need to log in
DB::update("UPDATE `logs` SET `status`= 1 WHERE `status` = 0 LIMIT 1")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question