private function findOrCreateUser($user) { if ($authUser = User::where('github_id', $user->id)->first()) { return $authUser; } return User::create(['name' => $user->name, 'email' => $user->email, 'github_id' => $user->id, 'avatar' => $user->avatar, 'token' => $user->token]); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }