Answer the question
In order to leave comments, you need to log in
Why is Request giving out the old route when making an ajax request?
Suppose there is a section1 in it controllers and for each role methods are cardinally separated, I decided to use middleware to call the desired controller from the role folder,
we take the priority role app ()-> call () controller, if not in the default one.
Http
- Controllers
- - Section1
- - - Admin
- - - - IndexController
- - - - MessageController
- - - IndexController
- - - MessageController Sample
routes
Route::prefix('section')
->namespace('Section')
->as('section.')->group(function () {
Route::get('/', '[email protected]')->name('index');
Route::prefix('messages')->as('messages.')->group(function () {
Route::post('/', '[email protected]')->name('index');
Route::put('/', '[email protected]')->name('store');
Route::prefix('{message}')->group(function () {
Route::delete('/', '[email protected]')->name('destroy');
});
});
});
public function handle($request, Closure $next)
{
dd($request->route());
axios({
method: 'post',
url: '/section/messages',
data: {}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question