In a laravel 5 application, I'm trying to make a route for subdomain without knowing the domain.
Route::group(array('domain' => 'subdomain.domain.tld'), function() {
Route::get('/', 'testController@getTest2');
});
Route::get('/', 'testController@getTest1');
This kind of routing works, and I get getTest2() called for subdomain and getTest1() for calling without subdomain.
Now, I'd like this to work with wildcard domain, but without sending parameters to controller, so the application in dev enviroinment can be on any domain. (I also considered using .env for storing domain, but that seems too much hassle for just routing)
I've tried
array('domain' => 'subdomain.{domain}.{tld}')
Which requires parameters on controller methods. and I've tried
array('domain' => 'subdomain.{domain?}.{tld?}')
Which doesn't require parameters, but sends them anyway, so my actual route parameters get shifted.
I've also seen http://laravel-tricks.com/tricks/dynamic-subdomain-routing, but I don't like the idea of handling my domains in filters.
Is there any other way to have a wildcard domain that will be ignored once route group is handled?