Beispiel #1
0
 /**
  * Determine if the user may perform the given permission.
  *
  * @param Permission $permission
  *
  * @return bool
  */
 public function hasPermission($permission)
 {
     // if passed a permission name, find it
     if (is_string($permission)) {
         $permission = PermissionModel::whereName($permission)->first();
         if (!$permission) {
             return false;
         }
     }
     // does user have roles with this permission
     return $this->hasRole($permission->roles);
 }