Why can't I store facebook id and avatar path with oauth login using laravel?
<p>I am using Socialite to login/register with facebook into my application. When I dump my $facebookUser variable I see this json : </p>

<p><strong>$facebookuser :</strong> </p>

<p><a href="https://i.stack.imgur.com/XmcZ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XmcZ3.png" alt="enter image description here"></a></p>

<p>But when I try to store the id and avatar , it doesn't store it and I can't display the users profile picture of facebook. I am using laravel to store my user.</p>

<p><strong>AuthController.php :</strong></p>

<pre><code>public function handleProviderCallback()
{
    try {
        $user = Socialite::driver('facebook')-&gt;user();
    } catch (Exception $e) {
        return redirect('auth/facebook');
    }

    $authUser = $this-&gt;findOrCreateUser($user);

    Auth::login($authUser, true);

    return redirect()-&gt;route('home')-&gt;with('successfullFacebookLogin', Auth::user()-&gt;name);
}

private function findOrCreateUser($facebookUser)
{
    // When I dd($facebookuser) it gives json stated above
    $authUser = User::where('facebook_id', $facebookUser-&gt;id)-&gt;first();

    if ($authUser){
        return $authUser;
    }

    return User::create([
        'name' =&gt; $facebookUser-&gt;name,
        'email' =&gt; $facebookUser-&gt;email,
        'facebook_id' =&gt; $facebookUser-&gt;user['id'],
        'avatar' =&gt; $facebookUser-&gt;avatar,
        'facebookAccount' =&gt; 1

    ]);
 }
</code></pre>