mardi 31 décembre 2019

Laravel - regex route match everything but not exactly one or more word

I make a route like

Route::get('/{url1}', function ($url1) {
    return ' url1: '.$url1;
})
->where('url1', '^(?!(string1|string2)$).*$');

and access url like: domain/string1 not found => correct

But when i do with

Route::get('/{url1}/{url2}', function ($url1) {
    return ' url1: '.$url1;
})
->where('url1', '^(?!(string1|string2)$).*$');

and access url like: domain/string1/abc found => incorrect

How to fix that thank



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire