kiritokatklian / nova-permission

A Laravel Nova tool for Spatie's laravel-permission library
https://novapackages.com/packages/vyuldashev/nova-permission
MIT License
68 stars 15 forks source link

getModelForGuard(): Argument #1 ($guard) must be of type string, null given #25

Closed Livijn closed 1 year ago

Livijn commented 1 year ago

I am getting an exception when viewing both the Role and Permission resource:

getModelForGuard(): Argument #1 ($guard) must be of type string, null given, called in /Users/fredrik/Documents/code/xxx/vendor/vyuldashev/nova-permission/src/Role.php on line 92

It's referencing this line: https://github.com/kiritokatklian/nova-permission/blob/master/src/Role.php#L99-L101

Specifically is the $this->guard_name null for some reason. When I look in the DB it's set to web and when I hardcode the $userResource = \App\Nova\User::class instead it doesn't throw an exception but it doesn't show the User. Very strange.

Livijn commented 1 year ago

Nvm, updated the package and this is no longer the issue. Creating another one.