Answer the question
In order to leave comments, you need to log in
How to update all records in a database using laravel eloquent (but without entering where)?
It was necessary to urgently update 1 column in all records. But in laravel, until now, I have only updated using the where clause. In this case, where is not needed, because must be updated in all records. How to be?
Thank you in advance!
Answer the question
In order to leave comments, you need to log in
\DB::table('tName')->update(['val' => 0]);
or
\DB::update("UPDATE `{$table}` SET `val` = ? WHERE 1", $params);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question