Answer the question
In order to leave comments, you need to log in
How to validate parameters in Route LARAVEL with regular expression?
Good afternoon.
Can you please tell me how to check a parameter in a Route with a pattern closure using a regular expression:
Route::get('user/{name}', function ($name) {
die("User: {$name}");
}) -> where ('name', '[\S]+');
Answer the question
In order to leave comments, you need to log in
Can be stupidly overkill
Route::get('user/{name}', function ($name) {
die("User: {$name}");
})->where('name', 'name|surname|age');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question