mardi 27 août 2019

index "/" route not working when using with a prefix in Laravel

I have the following route declaration:

Route::name('test.')
    ->prefix('test')
    ->group(function() {
        Route::get('/', function() {
            dd('test');
        })->name('index');
    });

Trying to access /test will result in NotFoundException, although when calling route('test.index') it will resolve to /test.

Same exception when trying to access /test/ and when trying to change the line:

Route::get('/', function()...

to

Route::get('', function()...

As soon as I modify it to

Route::get('/test', function()...

it works when trying to access ´/test/test´ and it also resolved the uri correctly when calling route('test.index').

What am I missing to to get the route working using '/' ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire