Silvanite / novatoolpermissions

Laravel Nova Permissions Tool (User, Roles and Permissions / Access Control (ACL))
MIT License
101 stars 33 forks source link

Call to undefined Method: Role::uriKey() #29

Open StanBarrows opened 5 years ago

StanBarrows commented 5 years ago

Hey there,

I've just installed your package on an empty project to play a little around. Once I created a role I receive this error. The error only appears if I add the relation on the UserRessource. Any ideas?

BelongsToMany::make('Roles', 'roles', Role::class),

image

Set-Up:

Cheers, Stan

themazim commented 5 years ago

Hey Stan,

I ran into the same error, solution is to use use Silvanite\NovaToolPermissions\Role; instead of use Silvanite\Brandenburg\Role; in nova/User.php

Your automatic Import probably used the second one instead of the first one, as stated in the readme.

prik commented 5 years ago

The solution is referring to the Nova Role resource instead of you main model:

BelongsToMany::make('Roles', 'roles', \App\Nova\Role::class),

paperscissors commented 4 years ago

I had no luck with this, since this is what the docs already said to do.

I've got use Silvanite\NovaToolPermissions\Role;

and BelongsToMany::make('Roles', 'roles', Role::class), and I'm still getting this error. I've tried switching to the Brandenberg class, same issue.

The one major thing I can report is that I am using my own App\User class.

preliot commented 4 years ago

Perhaps use php artisan vendor:publish --provider="Silvanite\NovaToolPermissions\Providers\PackageServiceProvider" ? (see docs)

paperscissors commented 4 years ago

I've actually followed these step by step, including the publish with the config, etc. Perhaps I will remove everything and try to install again from scratch.

paperscissors commented 4 years ago

No idea, I removed everything and went through the install again, the same as before and it worked. Best I can think of is that there was a single character off somewhere throwing the whole thing off, because otherwise everything was identical. Thanks!