/** * Return user if exists; create and return if doesn't * * @param $facebookUser * @return User */ private function findOrCreateUser(Facebook\GraphNodes\GraphUser $facebookUser) { $this->currentUser = $facebookUser['name']; // var_dump($facebookUser);exit; $authUser = User::where('facebook_id', $facebookUser['id'])->first(); if ($authUser) { $authUser->update(['avatar' => $facebookUser['picture']['url']]); return $authUser; } $hasher = app()->make('hash'); return User::create(['name' => $facebookUser['name'], 'email' => $facebookUser['email'], 'password' => $hasher->make(app()->make('config')->get('app.pass_prefix') . $facebookUser['id']), 'facebook_id' => $facebookUser['id'], 'avatar' => $facebookUser['picture']['url']]); }
public function authenticate($identity) { return \User::existsById((int) $identity); }
/** * Create a new user instance after a valid registration. * * @return \App\Auth\User * @param array $data */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }