Beispiel #1
0
 /**
  * Set roles and permissions.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable $user
  */
 public function setRolesAndPermissions(UserContract $user)
 {
     if ($user instanceof HasPermissions) {
         foreach ($user->getPermissions() as $permission) {
             $this->setPermission($permission);
         }
     }
     if ($user instanceof HasRoles) {
         foreach ($user->getRoles() as $role) {
             $this->attachRole($role);
         }
     }
     $this->resolved = true;
 }