src/Models/Role.php 1 location
|
@@ 124-129 (lines=6) @@
|
| 121 |
|
$permission = \app(Permission::class)->findByName($permission, $this->getDefaultGuardName()); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
if (! $this->getGuardNames()->contains($permission->guard_name)) { |
| 125 |
|
$expected = $this->getGuardNames(); |
| 126 |
|
$given = $permission->guard_name; |
| 127 |
|
|
| 128 |
|
throw new GuardDoesNotMatch($this->helpers->getGuardDoesNotMatchMessage($expected, $given)); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
return $this->permissions->contains('id', $permission->id); |
| 132 |
|
} |
src/Traits/HasPermissions.php 1 location
|
@@ 98-104 (lines=7) @@
|
| 95 |
|
*/ |
| 96 |
|
protected function ensureModelSharesGuard(Model $roleOrPermission) |
| 97 |
|
{ |
| 98 |
|
if (! $this->getGuardNames()->contains($roleOrPermission->guard_name)) { |
| 99 |
|
$expected = $this->getGuardNames(); |
| 100 |
|
$given = $roleOrPermission->guard_name; |
| 101 |
|
$helpers = new Helpers(); |
| 102 |
|
|
| 103 |
|
throw new GuardDoesNotMatch($helpers->getGuardDoesNotMatchMessage($expected, $given)); |
| 104 |
|
} |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
protected function getGuardNames(): Collection |