How can we update a column value of all selected rows in a database without using loop with Laravel's Eloquent/Fluent. See below.
It works for single record:
$singleUser = User::find(1);
$singleUser->status = '1';
$singleUser->save();
But it doesn't work for multiple records. It's showing "Method save does not exist."
$allUsers = User::all();
$allUsers->status = '1';
$allUsers->save();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire