I am trying to update multiple rows in table where role is equal to 3 but it seems not working properly. So what i am trying to achieve is first get all the users
, then get members from members
tables where school_id
is equal to to school_id
inside users table and user_id
is equal to id in user table. Then update all rows that match the criteria.
public function updateOwnrsRole()
{
$users = Users::all();
foreach ($users as $user) {
$members = Member::where('school_id', $user->id)
->where('user_id', $user->created_at)
->update(['role', 3]);
return $members;
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire