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()
{
...
});
see this link. http://laravel.com/docs/routing#sub-domain-routing
or Use this package.
https://github.com/jasonlewis/enhanced-router
It help you can set where on group routing like this.
Interested in this also! I'm trying to register a local development + production subdomain route, for the one controller action.
i.e.
I tried:
But it failed.
Not a huge issue, as DesignerGuy mentioned I can just pass in a function to both routes - but it would just be more elegant if they could be grouped :)
Currently you cannot. I had the same 'problem'; my fix is to cycle through your subdomains with a foreach and register the routes.
check in laravel docs, if you main domain is myapp, in production is
myapp.com
and in local environment ismyapp.dev
try using a*
according to laravel document in laravel 5.4+ you can use this way:
Laravel 5.1