src/Traits/HasPermissions.php 1 location
|
@@ 106-112 (lines=7) @@
|
103 |
|
*/ |
104 |
|
protected function ensureModelSharesGuard(Model $roleOrPermission) |
105 |
|
{ |
106 |
|
if (! $this->getGuardNames()->contains($roleOrPermission->guard_name)) { |
107 |
|
$expected = $this->getGuardNames(); |
108 |
|
$given = $roleOrPermission->guard_name; |
109 |
|
$helpers = new Helpers(); |
110 |
|
|
111 |
|
throw new GuardDoesNotMatch($helpers->getGuardDoesNotMatchMessage($expected, $given)); |
112 |
|
} |
113 |
|
} |
114 |
|
|
115 |
|
protected function getGuardNames(): Collection |
src/Models/Role.php 1 location
|
@@ 155-160 (lines=6) @@
|
152 |
|
$permission = \app(Permission::class)->findByName($permission, $this->getDefaultGuardName()); |
153 |
|
} |
154 |
|
|
155 |
|
if (! $this->getGuardNames()->contains($permission->guard_name)) { |
156 |
|
$expected = $this->getGuardNames(); |
157 |
|
$given = $permission->guard_name; |
158 |
|
|
159 |
|
throw new GuardDoesNotMatch($this->helpers->getGuardDoesNotMatchMessage($expected, $given)); |
160 |
|
} |
161 |
|
|
162 |
|
return $this->permissions->contains('id', $permission->id); |
163 |
|
} |