I use this package for localization https://github.com/mcamara/laravel-localization and it works fine in most cases except with one POST request.
When I try to access:
Route::group(
[
'prefix' => LaravelLocalization::setLocale(),
'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'auth'],
],
function () {
Route::post('bsSearch', 'BrandSpendingsController@search')->middleware('premium');
}
I get an MethodNotAllowedHttpException
... When I switch it to GET
it works fine... However it works for english language. If I switch the url to http://localhost/de/bsSearch , it throws an error.
Route::get('bsSearch', 'BrandSpendingsController@search')->middleware('premium');
I am really not sure why because this one works fine and it is a POST
method as well:
Route::post('editUserProfile/{id}', 'UserController@edit');
I use Laravel 5.3.
EDIT
The english url works because I've set 'hideDefaultLocaleInURL' => true,
in laravellocalization.php
and when it hides the "en" prefix in URL. If i set it to false
, it throws an error for English as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.