Route::domain('{account}.myapp.com')->group(function () {
Route::get('/', function ($account) {
dd("Cant hit this area");
});
Route::get('/test', function ($account) {
dd("No problem reaching this area");
});
});
When I visit my subdomain e.g. test.myapp.com it won't hit that DD but if say I do a /test and visit it, it would work.
I tried doing Route::get(' ' too , leaving it empty but it just wouldn't catch the base subdomain.
My Apache Conf : ServerAlias *.example.com
Ref : https://laravel.com/docs/5.8/routing#route-group-sub-domain-routing
Update
I also tried this, couldn't get it to execute
Route::group(['domain' => '{account}.example.co'], function () {
Route::get('/', function ($account) {
dd("HIT");
});
});
Found the solution.
Basically, I had this above the code I posted
It was overwriting my current route. I shifted my code above this code so it doesn't get overwritten by it.