When defining a route in Laravel 4 is it possible to define multiple URI paths within the same route?
presently i do the following:
Route::get(\'/\'
I find it interesting for curiosity sake to attempt to solve this question posted by @Alex as a comment under @graemec's answer to post a solution that works:
Route::get('/{name}', [
'as' => 'dashboard',
'uses' => 'DashboardController@index'
]
)->where('name', 'home|dashboard|'); //add as many as possible separated by |
Because the second argument of where()
expects regular expressions so we can assign it to match exactly any of those separated by |
so my initial thought of proposing a whereIn()
into Laravel route is resolved by this solution.
PS:This example is tested on Laravel 5.4.30
Hope someone finds it useful