SHARE
TWEET

Untitled

a guest Mar 20th, 2019 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $previousOwners = $this->userRepo()->hasRoles(['Owner'])->pluck('id')->toArray();
  2. $deleted = array_diff($previousOwners, $this->clinic_owners);
  3. $new = array_diff($this->clinic_owners, $previousOwners);
  4.  
  5. foreach ($deleted as $id) {
  6.     $user = $this->userRepo->find($id);
  7.     $user->removeRole('Owner');
  8. }
  9.  
  10. foreach ($new as $id) {
  11.     $user = $this->userRepo->find($id);
  12.     $user->assignRole('Owner');
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top