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

Call to undefined method App\Models\User:roles() and App\Models\User:permissions() #8

Closed kaizirlewagen closed 2 years ago

kaizirlewagen commented 2 years ago

After installation i got this errors while showing the user details ...

Call to undefined method App\Models\User:roles() and Call to undefined method App\Models\User:permissions()

I checked installation instructions but i don't find any mistakes.

In the log the following errors occurred:

[2022-04-14 08:03:40] local.ERROR: Call to undefined method App\Models\User::permissions() {"userId":1,"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method App\Models\User::permissions() at /var/www/html/nova/nova-test/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:71) [stacktrace]

Do you have any idea?

kaizirlewagen commented 2 years ago

Sorry i missed to modify the user model. First read the manual ;-)


use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;

    // ...
}```