Authenticate in another PHP / Laravel application

2

I am logged in to this PHP application, in this application has a list of users as shown below:

ByclickingthisLogarbuttonIwanttoberedirectedtoadashboardthatisinthesamedomain,butusesLaravelandrequiresauthenticationasshownbelow:

I have the authentication data to access this dashboard, but I wanted it to be done automatically when I clicked the Logar button, how could I do this using PHP?

    
asked by anonymous 18.07.2018 / 16:41

1 answer

0

You can use the login function of Auth , you pass the User model as a parameter, like this:

public function logar_com($id)
{
        Auth::login(User::findOrFail($id));
        return redirect()
            ->action('HomeController@index');

}

Instead of fetching User from id you can use where and search for email.

    
18.07.2018 / 18:06