Skip to content

Commit 6004bef

Browse files
authored
Merge pull request vyuldashev#142 from dnwjn/fix/permission-key
Fix for empty permission key
2 parents fdec1ac + 9329318 commit 6004bef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ForgetCachedPermissions.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Laravel\Nova\Nova;
88
use Spatie\Permission\PermissionRegistrar;
9+
use Illuminate\Support\Str;
910

1011
class ForgetCachedPermissions
1112
{
@@ -25,7 +26,7 @@ public function handle($request, $next)
2526
$request->is('nova-api/*/detach') ||
2627
$request->is('nova-api/*/*/attach*/*')
2728
) {
28-
$permissionKey = Nova::resourceForModel(app(PermissionRegistrar::class)->getPermissionClass())::uriKey();
29+
$permissionKey = Str::plural(Str::kebab(class_basename(app(PermissionRegistrar::class)->getPermissionClass())));
2930

3031
if ($request->viaRelationship === $permissionKey) {
3132
app(PermissionRegistrar::class)->forgetCachedPermissions();

0 commit comments

Comments
 (0)