How to get a link with subdomain either using url() helper or route() helper in Laravel?

  Kiến thức lập trình

I have set up my subdomain domain routes like this:-

Route::group(['domain' => '{subdomain}.' . env('APP_URL'), 'prefix' => 'console', 'namespace' => 'admin', 'middleware' => 'subdomain'], function () {
   Route::get('/login', 'LoginController@index')->name('admin.login');
});

And main domain routes like this-

Route::group(['prefix' => 'console', 'namespace' => 'admin', 'middleware' => 'maindomain'], function () {
    Route::get('/login', 'LoginController@index')->name('admin.login');
});

Now in an email, I want to send the login url of the subdomain.

  1. If I simply write route('admin.login') it will give me the login
    url of the main domain.
  2. url() . 'console/login' will also give me
    the login url of the main domain.

How can I get/print the login url of the subdomain?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT