Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Auto-load addon routes #10880

Merged
merged 1 commit into from
Oct 1, 2024
Merged

[5.x] Auto-load addon routes #10880

merged 1 commit into from
Oct 1, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Oct 1, 2024

It's pretty common for an addon to have routes/web.php, routes/cp.php, routes/actions.php route files. Right now, you have to configure these yourself in the addon's ServiceProvider:

protected $routes = [
    'web' => __DIR__.'/../routes/web.php',
    'cp' => __DIR__.'/../routes/cp.php',
    'actions' => __DIR__.'/../routes/actions.php',
];

However, if you're following convention, it would be nice if Statamic would automatically register an addon's route files, in a similar fashion to how fieldtypes, tags, etc are autoloaded.

Inspired by #9270.

@jasonvarga jasonvarga merged commit ca03ceb into 5.x Oct 1, 2024
19 checks passed
@jasonvarga jasonvarga deleted the autoload-addon-routes branch October 1, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants