Skip to content

Instantly share code, notes, and snippets.

@juniorb2ss
Last active November 24, 2015 00:55
Show Gist options
  • Save juniorb2ss/7011af64d2923102b6b5 to your computer and use it in GitHub Desktop.
Save juniorb2ss/7011af64d2923102b6b5 to your computer and use it in GitHub Desktop.
$userfb = Socialite::driver('facebook')->user();
$user = User::where('idsocial' ,$userfb->getId())->first();
if(!$user){
$user = new User();
$user->idsocial = $userfb->getId();
$user->social = "Facebook";
$user->avatar = $userfb->getAvatar();
$user->name = $userfb->getName();
$user->email = $userfb->getEmail();
$user->password = bcrypt('temp');
$user->save();
}
Session::put('id', $user->id);
Session::put('name', $user->name);
Auth::login($user);
return Redirect::to('/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment