kiritokatklian/nova-permission

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

Closed this issue · 1 comments

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?

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

use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;

    // ...
}```