Closed nekromoff closed 7 years ago
I just want to add that clearing cache via artisan does not help at all. Even clearing cache just for this module does not help.
I have same problem, but searching the method getPermissions in the class Spatie\Permission\PermissionRegistrar:
public function getPermissions(): Collection
{
return app(Permission::class)->with('roles')->get(); // <- don't use the cache
return $this->cache->remember($this->cacheKey, config('permission.cache_expiration_time'), function () {
return app(Permission::class)->with('roles')->get();
});
}
It works now, but it is a terrible idea to do this.
Update: The solution
php artisan cache:forget spatie.permission.cache
We are having the same problem here. Clearing the cache didn't help. It only fails on one that was newly created called admin.oauth. We tried changing the name, but get the same error. This is done via a migration.
Note: We discovered that if you pass in a collection and not an array of names, it works. So weird.
I have the same issue. Seems to be a caching issue. Everything works fine when I set my cache expire time to 0 in the permission config file.
'cache_expiration_time' => 0,
Is possible disable cache? Can be useful in devs environments.
@montyclt yes, publish the config file and set "cache_expiration_time" to 0
The readme of the package now contains a section on database seeding.
how to solve the error There is no permission named Administer roles & permissions
for guard web
.
Spatie \ Permission \ Exceptions \ PermissionDoesNotExist
I had the same issue and all the previous responses didn't worked.
The solution was to change the cache driver from file
to database
and it worked.
Be sure to create the cache table php artisan cache:table && php artisan migrate
Same for me. php artisan cache:clear
didn't work. Removing the cache folder in storage/framework
did.
This worked for me $role = Role::find($id); $role->name = $request->input('name'); $role->save();
$role->permissions()->sync($request->input('permission'));
e.g. RoleSeeder has some basic stuff in it:
php artisan db:seed --class=RoleSeeder
[Spatie\Permission\Exceptions\PermissionDoesNotExist]
There is no permission named
invoices.reinvoicing
for guardweb
.Only
web
guard is used.permissions table:
1 invoices.reinvoicing web 2017-06-09 01:27:13 2017-06-09 01:27:13