6 months ago

redirect to intended page after login - laravel 5.7

Posted 6 months ago by NasirNobin

I have an e-commerce site. When user going to checkout page, they need to login to the system. After authentication, the page will redirect to checkout page. I used multi-table-auth in my e-commerce website ( I used redirect()->intended(), which is not working. I also searched for result in online, nothing seems to working for my situation. Can anyone help me out! Here is my code for login:

use AuthenticatesUsers;

protected $redirectTo = '/';

public function __construct()

public function guard()
    return Auth::guard('customer');

public function login(Request $request)
    $rememberMe = $request->remember ? true : false;
    $customer = Customer::where(['phone' => $request->phone, 'password' => $request->pin])->first();

    if (!empty($customer)) {
        Auth::guard('customer')->login($customer, $rememberMe);

        return redirect()->intended('landing_page');

    return back()->withInput()->withErrors(['Invalid Credential!']);

Please sign in or create an account to participate in this conversation.