Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Attaching Permission to Role does not refresh cached permissions #949

Open disljenko opened 5 years ago

disljenko commented 5 years ago

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);

JackDPro commented 5 years ago

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

JackDPro commented 5 years ago

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.

collectiveThinking commented 4 years ago

thanks @dongkaipo