/** * @param \Laravel\Socialite\Contracts\User $userData * @return User */ public function findByUsernameOrCreate($userData) { $user = User::firstOrCreate(['username' => $userData->getNickname(), 'email' => $userData->getEmail()]); $user->full_name = $userData->getName(); $user->save(); return $user; }
/** * @param $username * @return bool */ public function setDenied($username) { $uid = User::query()->where('username', $username)->first(['id'])->id; $volunteer = Volunteer::query()->where('user_id', $uid)->firstOrFail(); $volunteer->pending = false; return $volunteer->save(); }
/** * 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'])]); }