public function startLogIn($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
- return $this->redirectToSocialProvider($driver)->redirect();
+ return $this->getSocialDriver($driver)->redirect();
}
/**
public function startRegister($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
- return $this->redirectToSocialProvider($driver)->redirect();
+ return $this->getSocialDriver($driver)->redirect();
}
/**
/**
* Provide redirect options per service for the Laravel Socialite driver
- * @param $driver
- * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ * @param $driverName
+ * @return \Laravel\Socialite\Contracts\Provider
*/
- public function redirectToSocialProvider($driver)
+ public function getSocialDriver(string $driverName)
{
- if ($driver == 'google' && config('services.google.select_account'))
- {
- return $this->socialite->driver($driver)->with(['prompt' => 'select_account']);
+ $driver = $this->socialite->driver($driverName);
+
+ if ($driverName === 'google' && config('services.google.select_account')) {
+ $driver->with(['prompt' => 'select_account']);
}
- return $this->socialite->driver($driver);
+ return $driver;
}
}