Skip to content

Commit eb7b3db

Browse files
committed
Updated policy checks to not fail if record already exists.
1 parent bf145da commit eb7b3db

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Http/Middleware/ParseCustomPolicyActions.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ protected function registerCustomPolicyActions(): void
6161

6262
if (! $permission) {
6363
$permissionClass = config("genealabs-laravel-governor.models.permission");
64-
(new $permissionClass)->create([
64+
(new $permissionClass)->firstOrCreate([
6565
"role_name" => "SuperAdmin",
6666
"entity_name" => $action->entity,
6767
"action_name" => $action->name,
6868
"ownership_name" => "any",
6969
]);
70-
$permissionClass = config("genealabs-laravel-governor.models.permission");
7170
$permissions = (new $permissionClass)
7271
->with("role", "team")
7372
->toBase()

0 commit comments

Comments
 (0)