Skip to content

Commit 79ae998

Browse files
committed
Extract query to getPermissionsWithRoles method.
1 parent fd66170 commit 79ae998

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PermissionRegistrar.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ public function getCacheStore(): Store
273273
return $this->cache->getStore();
274274
}
275275

276+
protected function getPermissionsWithRoles(): Collection
277+
{
278+
return $this->getPermissionClass()->select()->with('roles')->get();
279+
}
280+
276281
/**
277282
* Changes array keys with alias
278283
*
@@ -310,7 +315,7 @@ private function getSerializedPermissionsForCache()
310315
{
311316
$this->except = config('permission.cache.column_names_except', ['created_at', 'updated_at', 'deleted_at']);
312317

313-
$permissions = $this->getPermissionClass()->select()->with('roles')->get()
318+
$permissions = $this->getPermissionsWithRoles()
314319
->map(function ($permission) {
315320
if (! $this->alias) {
316321
$this->aliasModelFields($permission);

0 commit comments

Comments
 (0)