Example route/web.php file
// base_url example.com
Route::domain('app.example.com')->group(function(){
Route::get('/','ExampleController@method')->name('home1');
});
Route::get('/','ExampleController@method')->name('home2');
How to make;
- route('home1') return -> http://example.com
- route('home2') return -> http://app.example.com
always.
When going from home1 to home2, the subdomain changes, but when changing from home2 to home1 it stays the same.
My Answer:
> Route::get('/', function () {
> return 'Welcome to the app subdomain!';
> });
Rate this post
4 of 5 based on 9320 votesComments