title: Replace avatar Url on Social login with Laravel Socialite
body: <p>I'm facing an issue, I'm login with social networks and everything works perfect but my problem is with Avatars. When login, I get all the data including the Avatar but that avatar is saved in my database with Social Network original Url, I want to save it with my url instead.</p>
  
  <p>In other words, I save the profile pictures using timestamps and original file extension in <code>Laravel</code></p>
  
  <p>This my provider callback method in controller</p>
  
  <pre><code>public function handleProviderCallback(Request $request, $provider)
   {
       try
       {
           $socialUser = Socialite::driver($provider)-&gt;user();
       }
       catch(\Exception $e)
       {
           return redirect('/');
       }
       //Check if we have logged on Social Provider
  
       $socialProvider =   SocialProvider::where('provider_id', $socialUser-&gt;getId())-&gt;first();
       if (!$socialProvider)
       {
           //Create a new user and provider
           $user = new User;
           $user-&gt;name = $socialUser-&gt;getName();
           $user-&gt;profilepic = $socialUser-&gt;getAvatar();
           $user-&gt;email = $socialUser-&gt;getEmail();
  
           if($request-&gt;hasFile('avatar')){
               $profilepic = $request-&gt;file('avatar');
               $filename = time() . '.' . $profilepic-&gt;getClientOriginalExtension();
               Image::make($profilepic)-&gt;resize(300, 300)-&gt;save( public_path('/uploads/avatars/' . $filename ) );
               $user-&gt;profilepic = $filename;
           }
  
           $user-&gt;save();
  
           // $user = User::firstOrCreate([
           //   'name'  =&gt;  $socialUser-&gt;getName(),
           //   'profilepic' =&gt; $socialUser-&gt;getAvatar(),
           //   'email' =&gt;  $socialUser-&gt;getEmail()
           // ]);
  
           $user-&gt;socialProviders()-&gt;create(
             ['provider_id' =&gt; $socialUser-&gt;getId(), 'provider' =&gt; $provider]
           );
  
       Session::flash('success', 'Tu cuenta ha sido enlazada correctamente, sin embargo, ahora debes crear una contraseña. Crea tu contraseña ahora.');
  
      $user-&gt;save();
       auth()-&gt;login($user);
  
       return redirect('account-complete');
  
       }
       else
           $user = $socialProvider-&gt;user;
  
       auth()-&gt;login($user);
  
       return back();
  
   }
  </code></pre>
  
  <p>Im getting this URL with facebook:</p>
  
  <pre><code>https://graph.facebook.com/v2.10/10155364486426042/picture?type=normal
  </code></pre>
  
  <p>This is how i want it to be</p>
  
  <pre><code>http://localhost:8000/uploads/avatars/1519702861.jpg
  </code></pre>
  
  <p>Thanks in advance</p>