I am having an issue with laravel routing.
I want to have routes like this:
/ - home page for unauthenticated users
/login - login page
/register - register page
/dashboard - home page for authenticated users
After login i want user to be redirected to /dashboard, and if authenticated user goes to / or any other unprotected route, i also want to redirect him to /dashboard.
My routes.php.
`Route::get('/', 'HomeController@index');
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get(‘/dashboard’, ‘DashboardController@index');
Route::get('/logout', 'Auth\AuthController@logout');
});`
This works, however if authenticated user goes to / or any other unprotected route, i would like to redirect him to /dashboard. How can i make this work?
HomeController@indexmethod, do a check and redirect the Auth user to dashboard.Auth::check() ? return redirect()->url('/dashboard') : '';- Jilson Thomas