Root page (with "/" URL) of my website should be login page (with login form) (Laravel 5 stock Auth). After user is logging in he should see his account page on the same root URL (/). How I should do it properly?
My idea is like this:
Route::get('/', function(){
if (Auth::guest()) {
return view('auth.login');
} else {
return view('account.index');
}
});
But is is correct? It not looks like it's okay. May be I should use middleware or something else? I tried but without success.
I think you can redirect you root page to login page. The code may go like this
Route::get('/', function(){
if (Auth::guest()) {
return redirect()->route('show.login');
} else {
return view('account.index');
} });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.