Dump&Die the $user variable. Its a array of POPObjects. You can not pass it into Auth::login(User $user). So, you need to extract the id of the user and pass it to Auth::loginUsingId(int $id)
Here is a Eloquent example :
$user = User::whereEmail($result['email'])->first(['id']);
if (empty($user)) {
$user = new User;
...
$user->save();
}
Auth::login($user);
Also note that you require $user variable but you are creating user as $data variable which is also why you getting errors.
@mcraz Just noted that it shows this error: Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Auth\UserInterface, null given when user is logged in for the first time. And then when page is refreshed user is logged in.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.