Let's say I have the following:
Route::group(array('domain' => array('admin.example.com')), function()
{
...
});
Route::group(array('domain' => array('app.example.com')), function()
{
...
});
Route::group(array('domain' => array('dev.app.example.com')), function()
{
...
});
Is there any way to have multiple domains share a routing group? Something like:
Route::group(array('domain' => array('dev.app.example.com','app.example.com')), function()
{
...
});
You can pass on the domain name as well:
Just in case you need to know with which domain name the controller is called. Tested it with Laravel 5.6.
Laravel does not seem to support this.
I'm not sure why I didn't think of this sooner, but I guess one solution would be to just declare the routes in a separate function as pass it to both route groups.
I'm not sure if there is any significant performance impact to this solution.