jeudi 9 septembre 2021

How do I redirect my login link to show the landing page when someone logs into his account

I have two login links that appears on the navbar and the other one appears when a user clicks on the checkout button. I.ve configured the links at the logincontroller for the checkout page to be like this.

 protected function authenticated(Request $request, $user)
{           if(Auth::user()->userType == 'admin'){
            return redirect('/admin')->with('status','Welcome');
        }else{
            return redirect()->back()->with('status','Welcome');
        }
}.

As you can see, when the user is at the checkout page and manages to login to his account, he gets redirected to the same checkout page.I want the other login link to redirect the users to the landing page, but the users are redirected to the home page as shown in the url.

How can I change this a redirect them to the landing page which is 'http://127.0.0.1:8000.' If you're an expert with laravel, can you assist? It's an ecommerce application.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire