bezhanSalleh / filament-exceptions

A Simple & Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel
MIT License
153 stars 23 forks source link

Show Exception Viewer depending on user role #63

Closed FrazeColder closed 4 weeks ago

FrazeColder commented 1 month ago

Hey there,

first of all, thank you for this amazing plugin! I am forced to post this topic here as the other links such as asking the community returns a 404.. so, I am sorry for opening a bug ticket.

However, I would like to show or hide this plugin depending on the users' role. I am not using spatie permissions, nor I am using filament-shield and I also don't want to use these packages as I have a very simple user-role system. Everything else would be too complex and massively overpowered.

Back to my question: Is it possible any how to register this plugin depending on the user's role? If so, how can I archive this?

Kind regards

bezhanSalleh commented 4 weeks ago

yes, create a policy ExceptionPolicy for the model BezhanSalleh\FilamentExceptions\Models\Exception and in the viewAny() method of the policy apply your condition. now depending on your laravel version, enforcing the policy will difere so checkout the laravel docs for your specific laravel version.