samedi 22 décembre 2018

Laravel socialite Save avatar

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('/');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire