entrust icon indicating copy to clipboard operation
entrust copied to clipboard

Attaching Permission to Role does not refresh cached permissions

Open disljenko opened this issue 5 years ago • 3 comments

I'm using Laravel 5.8 and package version "zizaco/entrust": "5.2.x-dev". When attaching permission to role in the way shown below cache is not updated until i fire: "php artisan cache:clear" For Caching i'm using redis. I have other Laravel project v5.6 and everything just work fine.

$role = Role::find($role_id); $role->attachPermission($permission);

disljenko avatar Jun 06 '19 16:06 disljenko

And i change role_user table data manually , it not work.

JackDPro avatar Jun 16 '19 03:06 JackDPro

Add Cache::tags(config('entrust.role_user_table'))->flush(); to your code where attaching permission or detach permission, the cache will refresh. @disljenko . It works to me.

JackDPro avatar Jun 16 '19 04:06 JackDPro

thanks @dongkaipo

collectiveThinking avatar Dec 16 '19 16:12 collectiveThinking