reminder_months_before = $user->reminder_months_before; $this->ocr_provider = $user->ocr_provider; $this->hasApiKey = filled($user->ocr_api_key); $this->ocrAvailable = $user->plan()->includesOcr(); } /** * @return array */ private function allowedOcrProviders(): array { return $this->ocrAvailable ? OcrManager::availableProviders() : ['none']; } public function updateSettings(): void { $validated = $this->validate([ 'reminder_months_before' => ['required', 'integer', 'min:0', 'max:24'], 'ocr_provider' => ['required', Rule::in($this->allowedOcrProviders())], 'ocr_api_key' => ['nullable', 'string', 'max:255'], ]); $user = Auth::user(); $user->reminder_months_before = $validated['reminder_months_before']; $user->ocr_provider = $validated['ocr_provider']; // Only overwrite the stored key when a new one is entered, so the // masked field can be left blank to keep the existing key. if (filled($validated['ocr_api_key'])) { $user->ocr_api_key = $validated['ocr_api_key']; } elseif ($validated['ocr_provider'] === 'none') { $user->ocr_api_key = null; } $user->save(); $this->reset('ocr_api_key'); $this->hasApiKey = filled($user->ocr_api_key); Flux::toast(variant: 'success', text: __('Certificate settings updated.')); } }; ?>
@include('partials.settings-heading')
{{ __('None (manual entry)') }} @if ($ocrAvailable) {{ __('Klippa (EU / NL)') }} {{ __('Mistral Pixtral (EU / FR)') }} @endif @unless ($ocrAvailable) {{ __('Document scanning is available on Certified Starter and Certified Pro.') }} {{ __('Upgrade your plan') }} @endunless @if ($ocr_provider !== 'none') @endif
{{ __('Save') }}