Skip to content
Advertisement

Laravel routing: Route in domain group visible also in local environment

What I need: My app has a public domain All routes in my Admin controller should be opened only if the remote domain is domain1.com and also in local environment.

Currently: if I put the admin panel route in the group, it is not visible in local environment any more, making it difficult to develop.

JavaScript

Solutions

My current solution: in route file web.php I add extra line

JavaScript

but it is a crude, temporary fix.

TODO:

  • Either in route file or in the controller. A filter in a controller (for all or selected methods) would be best.
  • An if clause checking if either the environment is local or the domain is domain1.com

Thank you.

Advertisement

Answer

I think laravel not support something like that. But you can declare the routes to a function variable and then use it in each domain.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement