Dec 16, 2020
0
Level 6
middleware conflits with laravel nova
ho creato questo middleware Set Language:
public function handle(Request $request, Closure $next)
{
\App::setLocale($request->language);
URL::defaults(['language' => $request->language]);
$request->route()->forgetParameter('language');
return $next($request);
}
}
and the following web routes:
Route::group(['prefix'=>'{language}'], function(){
Route::get('/', [ArticleController::class, 'index']);
Route::get('/articles', [ArticleController::class, 'index1']);
Route::get('articles/create', [ArticleController::class, 'create']);
Route::get('articles/create_all', [ArticleController::class, 'createAll']);
Route::post('articles_all', [ArticleController::class, 'storeAll']);
Route::post('articles', [ArticleController::class, 'store']);
Route::get('articles/{article}', [ArticleController::class, 'show']);
Route::get('articles/{article}/edit', [ArticleController::class, 'edit']);
Route::put('articles/{article}', [ArticleController::class, 'update']);
});
this middleware works with normal laravel, but doesn't work with nova. in practice it does not allow me to enter the classic nova login at the link: .../nova/login.
basically with this middleware when I'm on the link http://novatowerb.test/it/ the language is set in Italian so I would expect nova to be configured in Italian. only the link ... / nova / login doesn't go there
Please or to participate in this conversation.