Example #1
0
 /**
  * Determine if the given user has the requested role.
  *
  * @param string $name Role name.
  *
  * @return boolean
  */
 public function hasRole($name)
 {
     $role_id = Role::getRoleId($name);
     try {
         RoleMember::where('user_id', $this->id)->where('role_id', $role_id)->firstOrFail();
         return true;
     } catch (Exception $e) {
         return false;
     }
 }