How to set every row to the same value with Laravel’s Eloquent/Fluent?

Just to keep this thread current, you can update all rows against an Eloquent model directly using:

Model::query()->update(['confirmed' => 1]);

If you are using something like WHERE

Model::where('foo', '=', 'bar')->update(['confirmed' => 1])

If you want to include soft deleted rows as well

Model::query()->withTrashed()->update(['confirmed' => 1]);

Leave a Comment