Inheritance: use trait Illuminate\Auth\Access\HandlesAuthorization
 /**
  * Get the given user's roles.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $user
  * @return \Illuminate\Support\Collection
  */
 public function getRoles(Model $user)
 {
     $key = $this->tag . '-roles-' . $user->getKey();
     return $this->cache->sear($key, function () use($user) {
         return parent::getRoles($user);
     });
 }
Exemple #2
0
 /**
  * Check if the user has all of the given roles.
  *
  * @param  string|array  $roles
  * @return bool
  */
 public function all($roles)
 {
     return $this->clipboard->checkUserRole($this->user, $roles, 'and');
 }
Exemple #3
0
 /**
  * Check if the user has all of the given roles.
  *
  * @param  string  $role
  * @return bool
  */
 public function all($role)
 {
     $roles = func_get_args();
     return $this->clipboard->checkRole($this->user, $roles, 'and');
 }
 /**
  * Get the given authority's roles.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $authority
  * @return \Illuminate\Support\Collection
  */
 public function getRoles(Model $authority)
 {
     $key = $this->getCacheKey($authority, 'roles');
     return $this->sear($key, function () use($authority) {
         return parent::getRoles($authority);
     });
 }