filament-blog icon indicating copy to clipboard operation
filament-blog copied to clipboard

How to add permissions and roles to filament-blog with Shield plugin

Open benib3 opened this issue 11 months ago • 2 comments

Hello everyone, I have seen somewhere people struggled to add permissions and roles for this plugin as I did also... So I found a way how to add to filament blog plugin permissions and roles using also widely popular Shield plugin, it might not be convenient way but it works for me.

  1. Copy resources provided from filament-blog ( Me personally created a command to copy from vendor all resources ) image
  2. When copied run php artisan shield:generate --all and it will generate policies with coresponding resources from filament-blog
  3. Most important is to add Gate Policies if u use Laravel 11^ its in AppServiceProvider.php image
  4. Optionaly u can add also HasShieldPermissions interface to resources.

benib3 avatar Jan 10 '25 19:01 benib3

No working man, I tried like above.

udaykiranchenna2 avatar Jan 29 '25 18:01 udaykiranchenna2

No working man, I tried like above.

Well are you sure u setup everything correctly because I've just tested it one more time on new project and it works. I will publish repo publicly so maybe check if u missed something.

benib3 avatar Jan 30 '25 11:01 benib3