Laratrust\Traits\LaratrustUserTrait::cachedRoles PHP Метод

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

Tries to return all the cached roles of the user and if it can't bring the roles from the cache, it would bring them back from the DB
public cachedRoles ( ) : Illuminate\Database\Eloquent\Collection
Результат Illuminate\Database\Eloquent\Collection
    public function cachedRoles()
    {
        $cacheKey = 'laratrust_roles_for_user_' . $this->getKey();
        return Cache::remember($cacheKey, Config::get('cache.ttl', 60), function () {
            return $this->roles()->get();
        });
    }