components([ $this->getLoginFormComponent(), $this->getPasswordFormComponent(), $this->getRememberFormComponent(), ]); } protected function getLoginFormComponent(): TextInput { return TextInput::make('login') ->label('Email or Phone Number') ->required() ->autofocus(); } protected function getCredentialsFromFormData(array $data): array { $login_type = filter_var($data['login'], FILTER_VALIDATE_EMAIL) ? 'email' : 'phone_number'; return [ $login_type => $data['login'], 'password' => $data['password'], ]; } protected function throwFailureValidationException(): never { throw ValidationException::withMessages([ 'data.login' => __('filament-panels::auth/pages/login.messages.failed'), ]); } }