I have admin prefix where url/admin/dashboard is my dashboard view.
What I need is to redirect users to url above if they type only url/admin .
This is what I have:
Route::prefix('admin')->group(function () {
Route::get('dashboard', 'HomeController@index')->name('dashboard'); //works
Route::get('/', function () {
return redirect()->route('dashboard');
}); //doesn't work
});
You might want to use this:
Route::get('url/admin/dashboard', 'HomeController@index')->name('dashboard');
Route::get('url/admin', function () {
return redirect('url/admin/dashboard');
});
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