multitenacy combined with tenancyforlaravel and filament shield permission problem
Hello all,
I have a a problem with the permissions of filament shield. When i run the shield:generate on the admin app all is working for the admin. But then when I run the shield:generate for the tenant (different database) with tenants:run β¦ the permissions are ok for the tenant but not anymore for the admin.
I think it has something todo with the caching of the permissions.
So two quesions:
Is there a way to disable the caching of the permission for testing purpose?
Is there a way to cache the permissions for a panel?
I hope someone knows the answer π¬
Thanks already
Solution:Jump to solution
1. To disable cache in dev mode set the
CACHE_DRIVER=array
in .env file or set the cache store to array from permission config file. learn more https://spatie.be/docs/laravel-permission/v5/advanced-usage/cache
2. since you are using that package you need to add the following in TenancyServiceProvider
```php
Events\TenancyBootstrapped::class => [
function (Events\TenancyBootstrapped $event) {...5 Replies
Solution
1. To disable cache in dev mode set the
CACHE_DRIVER=array
in .env file or set the cache store to array from permission config file. learn more https://spatie.be/docs/laravel-permission/v5/advanced-usage/cache
2. since you are using that package you need to add the following in TenancyServiceProvider
learn more https://tenancyforlaravel.com/docs/v3/integrations/spatieThanks man will give it a try and let you know
@Bezhan first tests seems to be okay π . I think you made my day for now hehe
Will test tomorrow better and let you know
Thanks already
Glad it could help, just mark it as solved if that was all you needed. π»
Will do it for sure, gonna start testing different scenarios right now π
Seems to be okay
Thanks man
With the changes to laravel-permission 6 some things have changed.
You need to create a Bootstrapper to change the cacheKey.
and add the bootstrapper to tenancy.php