Autodiscover policies in other routes
jals-es opened this issue · comments
The filament-shield plugin has a problem when policies have been rerouted and an autodiscover has been created.
For example, I have my Laravel application modularized as packages. I have created an autodiscover for the policies as Laravel says in its official documentation. https://laravel.com/docs/10.x/authorization#policy-auto-discovery
So far everything is correct and filament does pay attention to these policies.
The problem comes with the filament-shield commands, such as php artisan shield:generate --all
, which regenerates the policies in app/Policies
without paying attention to the ones I have published in modules route. So if I have customizations, it does not detect them and duplicates them.
this ain't an issue but a feature request because shield doesn't support a modular arch. though it has a very basic setup that should work with a modular arch with some custom logic on your part. Basically you can create a custom command where you set policy namespace and directory config keys dynamically and then run the shield generate command based on those config according to your modules. these days i don't have much time to build it myself but it will eventually happen unless of course someone else PRs it first.