Closed liepumartins closed 6 years ago
Hi Liepumartins,
This is indeed a function that requires the spatie/laravel-permission. I think you can fix this problem bij adding the trait Spatie\Permission\Traits\HasRoles to your User model. Hope this helps. I'll check the documentation if this is a missing part.
Hi,
Thanks for quick reply!
Next question, still applies to this topic - do I have to seed all permissions manually, generator does not provide this?
If I run test I get: Spatie\Permission\Exceptions\PermissionDoesNotExist : There is no permission named retrieve_sample
. This happens for each const
defined in app/Permissions/SamplePermissions.php
and goes away only when I manually insert in permissions
table.
I believe generator should use something like this: https://github.com/spatie/laravel-permission#database-seeding
This is correct what you mention, we have not made a seeder for adding permissions that have been generated. Now that you mention it, this might be an excellent addition to this package.
https://github.com/spatie/laravel-permission#database-seeding Here is an example how to generate a seeder for your problem instead of adding them manually in the table. I will add this to our backlog.
When running tests I encounter:
BadMethodCallException : Call to undefined method App\User::givePermissionTo()
Reading through the README I did not see any information about required package or other instructions how to enable permissions for users.
Is it assumed to use spatie/laravel-permission package?