@@ 95-107 (lines=13) @@ | ||
92 | * @return mixed |
|
93 | * @throws LevelNotFoundException |
|
94 | */ |
|
95 | protected function getALevel($level) |
|
96 | { |
|
97 | if (is_string($level)) { |
|
98 | $level = config('laravel-acl.level', Level::class)::whereName($level)->first(); |
|
99 | } |
|
100 | ||
101 | if (is_int($level)) { |
|
102 | $level = config('laravel-acl.level', Level::class)::find($level); |
|
103 | } |
|
104 | ||
105 | if (!$level) { |
|
106 | throw new LevelNotFoundException(); |
|
107 | } |
|
108 | ||
109 | return $level; |
|
110 | } |
@@ 486-498 (lines=13) @@ | ||
483 | * @return \z1haze\Acl\Models\Permission |
|
484 | * @throws PermissionNotFoundException |
|
485 | */ |
|
486 | protected function getPermission($permission) |
|
487 | { |
|
488 | if (is_string($permission)) { |
|
489 | $permission = config('laravel-acl.permission', Permission::class)::whereName($permission)->first(); |
|
490 | } |
|
491 | ||
492 | if (is_int($permission)) { |
|
493 | $permission = config('laravel-acl.permission', Permission::class)::find($permission); |
|
494 | } |
|
495 | ||
496 | if (!$permission) { |
|
497 | throw new PermissionNotFoundException; |
|
498 | } |
|
499 | ||
500 | return $permission; |
|
501 | } |