Silber\Bouncer\CachedClipboard::getRoles PHP Метод

getRoles() публичный Метод

Get the given authority's roles.
public getRoles ( Model $authority ) : Collection
$authority Illuminate\Database\Eloquent\Model
Результат Illuminate\Support\Collection
    public function getRoles(Model $authority)
    {
        $key = $this->getCacheKey($authority, 'roles');
        return $this->sear($key, function () use($authority) {
            return parent::getRoles($authority);
        });
    }

Usage Example

Пример #1
0
 /**
  * Get the user's roles from the given cache instance through the clipboard.
  *
  * @param  \Illuminate\Cache\ArrayStore  $cache
  * @param  \Illuminate\Database\Eloquent\Model  $user
  * @return array
  */
 protected function getRoles(ArrayStore $cache, Model $user)
 {
     $clipboard = new CachedClipboard($cache);
     return $clipboard->getRoles($user)->all();
 }