pavsid's avatar

Admin subdomain

Hi all, i'm creating an admin area for my application and am putting it under an "admin" subdomain i.e. admin.example.com

I've set up a route group like so, and placed it at the top of my routes.php

Route::group([
    'domain' => 'admin.localhost',
    'as' => 'admin',
    'namespace' => 'Admin'
], function () {
    Route::get('', [
        'as' => '.dashboard',
        'uses' => 'DashboardController@index'
    ]);

    // etc...
});

I'll add some middleware in later to check that the user has admin privileges, but i've noticed that I can access the main application's pages on the subdomain e.g. admin.example.com/about or admin.example.com/contact..

  1. What's the best way to separate out the two "areas" so that pages in the main app aren't accessible from the admin subdomain and visa-versa
  2. How would I generate a URL to the main app e.g. www.example.com/about from within the admin area?

Many thanks.

0 likes
1 reply
lara35880's avatar

Hello,

10 months after I would be very interested on how you finally tackled (I hope) this issue.

Thanks

Please or to participate in this conversation.