Monday, April 10, 2017

Subdomains and Auth with laravel

I am created a project which has multiple different sections all stored within a subdomain for example:

core.sample.com
map.sample.com
character.sample.com

I want the user to only be able to login at: sample.com and see a page to select which section they want to go to.

I have created the first subdomain

Route::group(['domain' => 'core.rpsbackpack.com'], function () {
    Route::get('/', 'CoreController@index')->name('core.index');
});

However I now need to disable the login process or redirect to the main domain. However i cant work out how to get this working. I have the Auth route at the top of the folder but I dont know if this is correct.

Auth::routes();

Route::group(['domain' => 'core.rpsbackpack.com'], function () {
    Route::get('/', 'CoreController@index')->name('core.index');
});

Route::get('/', function () {
    return view('welcome');
});

What is the best way to easily support lots of subdomains?



via Dev Daniel

Advertisement