middleware('guest:frontend')->except('logout'); } /** * Get the guard to be used during authentication. */ protected function guard(): StatefulGuard { return Auth::guard('frontend'); } /** * Show the application's login form. * * @return \Illuminate\View\View */ public function showLoginForm(): View { /** @var view-string $view */ $view = 'theme::auth.login'; return view($view); } /** * Check if the authenticated user can access the game * * @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing, Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed */ protected function authenticated(Request $request, Customer $user): void { /** @var \LDC\LDCCRM\Models\Customer $crmCustomer */ $crmCustomer = $user->api_data; /** @var Settings */ $settings = resolve(Settings::class); $countries = $settings->authorized_countries; if (count($countries) && ! in_array($crmCustomer->country->value, $countries)) { $this->logout($request); Session::flash('info', trans('front.messages.game_not_available_in_country')); } else { $user->last_connection = \now(); $user->saveOrFail(); Session::flash('info', trans('front.messages.login_success')); } } /** * The user has logged out of the application. * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ protected function loggedOut(Request $request): void { Session::flash('info', trans('front.messages.logout_success')); } /** * Get the post register / login redirect path. */ public function redirectPath(): string { return response()->redirectToIntended()->getTargetUrl(); } }