apiary icon indicating copy to clipboard operation
apiary copied to clipboard

Flush cached permissions when roles/permissions are attached/detached from users

Open kberzinch opened this issue 2 years ago • 5 comments

kberzinch avatar May 17 '22 01:05 kberzinch

@evan10s can you add relevant snippets here please

kberzinch avatar May 17 '22 01:05 kberzinch

https://gist.github.com/evan10s/835cbdf57e72120d978adf77e65039b7

Most of this is borrowed from StackOverflow, it's not really anything special. Make sure to use the modified HasRolesTrait (not sure why trait is in the name, but) on the User model.

evan10s avatar May 17 '22 01:05 evan10s

Hm that's more complicated than i expected. Need to check how the nova package modifies roles, i vaguely recall it being a direct DB write.

kberzinch avatar May 17 '22 04:05 kberzinch

https://laravel-news.com/laravel-model-caching

kberzinch avatar May 17 '22 04:05 kberzinch

https://matthewdaly.co.uk/blog/2018/01/12/creating-a-caching-user-provider-for-laravel/

kberzinch avatar May 17 '22 04:05 kberzinch