...
use LaurentEsc\Localization\Facades\Localize;
...
public function boot(Router $router)
{
// This will guess a locale from the current HTTP request
// and set the application locale
Localize::detectLocale();
parent::boot($router);
}
...
// Without the localize middleware, this route can be reached with or without language subdomain
Route::get('logout', 'AuthController@logout');
// With the localize middleware, this route cannot be reached without language subdomain
Route::group([ 'middleware' => [ 'localize' ]], function() {
Route::get('welcome', 'WelcomeController@index');
});