Skip to content

Commit 3aab62f

Browse files
authored
Add CacheRepository getter (#1946)
1 parent 2017a98 commit 3aab62f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/PermissionRegistrar.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use Illuminate\Cache\CacheManager;
66
use Illuminate\Contracts\Auth\Access\Authorizable;
77
use Illuminate\Contracts\Auth\Access\Gate;
8+
use Illuminate\Contracts\Cache\Repository;
9+
use Illuminate\Contracts\Cache\Store;
810
use Illuminate\Database\Eloquent\Collection;
911
use Spatie\Permission\Contracts\Permission;
1012
use Spatie\Permission\Contracts\Role;
@@ -79,7 +81,7 @@ public function initializeCache()
7981
$this->cache = $this->getCacheStoreFromConfig();
8082
}
8183

82-
protected function getCacheStoreFromConfig(): \Illuminate\Contracts\Cache\Repository
84+
protected function getCacheStoreFromConfig(): Repository
8385
{
8486
// the 'default' fallback here is from the permission.php config file,
8587
// where 'default' means to use config(cache.default)
@@ -265,12 +267,12 @@ public function setRoleClass($roleClass)
265267
return $this;
266268
}
267269

268-
/**
269-
* Get the instance of the Cache Store.
270-
*
271-
* @return \Illuminate\Contracts\Cache\Store
272-
*/
273-
public function getCacheStore(): \Illuminate\Contracts\Cache\Store
270+
public function getCacheRepository(): Repository
271+
{
272+
return $this->cache;
273+
}
274+
275+
public function getCacheStore(): Store
274276
{
275277
return $this->cache->getStore();
276278
}

0 commit comments

Comments
 (0)