user5405873
user5405873

Reputation:

i'm unable to get object data

I'm using Facebook login with Socialite which is dumping the user as shown below.

 dd($user);

output:

enter image description here

How to get user details from above object shown in image?

i'm trying to access like this but getting error

$user = Socialite::driver('facebook')->user();

dd($user->user[0],$user->user[1],$user->user[2],$user->user[3],$user->user[4]);

Upvotes: 2

Views: 75

Answers (1)

RAUSHAN KUMAR
RAUSHAN KUMAR

Reputation: 6006

use like this to get the user data array from the socialite result

$providerUser = Socialite::driver('facebook')->user();
$user=json_decode(json_encode($providerUser,true),true);
$user=$user['user'];

Upvotes: 3

Related Questions