mercredi 27 mars 2019

Laravel get route current domain in multiple domains route

I wanted to prevent access to some of my app routes from other domain except listed. It success using below code:

$loginRoutes = function() {
Route::get('/', 'HomeController@index')->name('home');
};

Route::domain('domain1.com')->group($loginRoutes);
Route::domain('domain2.com')->group($loginRoutes);
Route::domain('localhost')->group($loginRoutes);

But the problem is when I call , the URL always becomes http://localhost or domain at the last line. How to make it to current domain?

I use laravel 5.7 in php 7.3.3



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire