Enhance Policy Auto-Discovery to Support Subdirectories #55036
Unanswered
Usmanzahidcode
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, Laravel requires users to manually register policies in 'AuthServiceProvider' unless they follow the exact naming convention and place them directly in 'app/Policies'. However, policies within subdirectories are not automatically discovered, even when they adhere to Laravel’s default naming conventions. This forces unnecessary manual registration and limits flexibility in organizing policies.
Proposed Enhancement:
Laravel should automatically resolve policies located within subdirectories of 'app/Policies' without requiring explicit registration. Manual registration should still be supported for:
This enhancement would improve the developer experience by reducing boilerplate while maintaining flexibility for advanced use cases.
Beta Was this translation helpful? Give feedback.
All reactions