I have configured my multilingual laravel(5.4) application according the blog http://ift.tt/2oFqlIN. Now I want to show the language prefix only for the public interface of the application such as
http://ift.tt/2oTsjl6
and admin dashboard url without prefix such as
1. domain.com/dashboard,
2. http://ift.tt/2oFDuSm
So I have assigned \App\Http\Middleware\Language::class class reference
at the Http\Kernel.php within
protected $routeMiddleware = [
.
.
.
'lang' => \App\Http\Middleware\Language::class
]
and I want to filter all public routes like
Route::group(['middleware' => ['lang']], function(){
Route::get('lang/{language}', ['as' => 'lang.switch', 'uses' => 'LanguageController@switchLang']);
Route::get('/', ['as' => 'home', 'uses' => 'PostController@index']);
Route::get('/post/{slug}', ['as' => 'post.show', 'uses' => 'PostController@show']);
});
So I have configured App\RouteServiceProvider with
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
$locale = Request::segment(1);
Route::group([
'middleware' => 'lang',
'namespace' => $this->namespace,
'prefix' => $locale
], function ($router) {
require base_path('routes/web.php');
});
Now all my public route are working with language prefix but my admin dashboard route also includes the language prefix that doesn't suppose to be
What is your suggestion to configure my app to get the acquired result.
Best Regards
Manoz
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oTssop
via IFTTT
Aucun commentaire:
Enregistrer un commentaire