Laravel socialite Save avatar

Posted 1 month ago by Kareimovich

everybody, I need to Save image name in the avatar column in the database and save the image in public/Storage/users My Code Here Save image link in the database any help, please.

public function handleProviderCallback($service)
   {
        $user = Socialite::driver($service)->user();
        $FindUser = User::where('email',$user->getEmail())->first();
        if($FindUser){
              Auth::login($FindUser);
            }
            else{
             $NewUser = new User;
         $NewUser->email = $user->getEmail();
    $NewUser->name  = $user->getName();
        $NewUser->avatar  = $user->getAvatar();
        $NewUser->password  = bcrypt(123456);
            $NewUser->save();
             Auth::login($NewUser);
           }
     return redirect('/');
    }

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

Reply to

Use Markdown with GitHub-flavored code blocks.