Reputation: 17289
in Laravel
i have this route group:
Route::prefix('panel')->group(function(){
Route::get('/', AdminComponent::class);
Route::get('/administrator', AdminComponent::class);
});
and my question is how can i combine this urls
which they have the same behavior to open manage url
can i combine this routes to single route? for example:
Route::prefix('panel')->group(function(){
Route::get('/|administrator', AdminComponent::class);
});
Upvotes: 2
Views: 432
Reputation: 430
Maybe you could do something like this:
Route::prefix('panel')->group(function(){
Route::get('/{url?}', function () {
//redirect or return view here
})->where(['url' => 'administrator']);
});
Adding another route like 'administrator2' would be:
->where(['url' => 'administrator|administrator2'])
Upvotes: 4