Is that possible to make route
that accept string parameter only for specific string? Example :
Route::get('{user_tipe}/event', 'admin\EventC@index');
That the route, I want to make the user_tipe
param is only allow to two string like admin
and author
. Is that possible?
You can do that using regular expression constraits on your route:
Route::get('{user_tipe}/event', 'admin\EventC@index')->where('user_tipe', 'admin|author');
admin|author
is a simple regular expression that will match either the string admin
or author
UPDATE
Here you can find how to use the route param constraints when using Route::group
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With