public function findByUserNameOrCreate($userData) { //dd(isset($userData->user['domain'])); if (isset($userData->user['domain'])) { // dd($userData->user['domain']=="iccabq.org"); if (!$userData->user['domain'] == "montserratretreat.org") { redirect('/restricted'); } } else { redirect('/restricted'); } $user = User::where('provider_id', '=', $userData->id)->first(); if (!$user) { $user = User::create(['provider' => 'google', 'provider_id' => $userData->id, 'name' => $userData->name, 'username' => $userData->nickname, 'email' => $userData->email, 'avatar' => $userData->avatar, 'active' => 1]); } $this->checkIfUserNeedsUpdating($userData, $user); //dd($user); return $user; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }