douningchang3610 2017-12-05 09:52
浏览 41

使用php framework laravel登录后重定向页面

I'm trying to show a page from myController after successful to login.

$email = $req->input('username');
$pass = $req->input('password');
$login = DB::table('for_login')->where(['E_mail'=>$email, 'Password'=>$pass])->get();
if(count($login)>0) {              
    return view('frontEnd.Home');
} else {
    echo "Invalid username/password";
}

How can I redirect a page after a successful login?

delAction

  • 写回答

3条回答 默认 最新

  • dongyuan8024 2017-12-05 09:58
    关注

    Go to AuthController.php and add authenticated method'

    protected function authenticated($request){
        return view('frontEnd.home');
    }
    

    The built-in authentication functionality of laravel looks for authenticated method upon successful login and performs it, if it is declared. Hope this helps.

    评论

报告相同问题?