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/abc not found => incorrect ??
- domain/string1 not found => correct

and more, when i do with

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

and access url like:
- domain/abc/abc not found => incorrect ???
- domain/string1/abc not found => correct

How to fix that thank



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire