예제 #1
0
 /**
  * Get allowed roles for the current user.
  *
  * @return mixed
  */
 protected function getAllowedRoles()
 {
     if ($this->request->user('administrator')->isRole('super-administrator')) {
         $roles = $this->role->get();
     } else {
         $roles = $this->role->where('slug', '!=', 'super-administrator')->get();
     }
     return $roles;
 }
예제 #2
0
 /**
  * Attach a role to user using slug.
  *
  * @param $slug
  * @return bool
  */
 public function attachRoleBySlug($slug)
 {
     $role = Role::where('slug', $slug)->first();
     return $this->attachRole($role);
 }