'Requests', 'section' => 'Visitors', 'route' => Names::route('leads.index'), 'permission' => 'leads.view', 'simple' => true, 'hint' => 'The messages and requests from your website']]; } /** @return array> what the settings screen can change */ public function settings(): array { return [ 'manager.leads.notify' => ['label' => 'Mail new requests to', 'type' => 'text', 'group' => 'Requests', 'sensitive' => true, 'help' => 'The mail address that is told about every real request', 'env' => 'MANAGER_LEADS_NOTIFY'], 'manager.leads.confirm' => ['label' => 'Mail the visitor a confirmation', 'type' => 'toggle', 'group' => 'Requests'], 'manager.leads.keep_days' => ['label' => 'Days a request is kept', 'type' => 'number', 'group' => 'Requests'], 'manager.leads.keep_spam_days' => ['label' => 'Days spam is kept', 'type' => 'number', 'group' => 'Requests'], ]; } public function boot(): void { // A form may be sent so many times an hour per address, and by everyone together. Over the limit the visitor is told to wait. RateLimiter::for('manager-leads', fn (Request $request) => [ Limit::perHour(max(1, (int) config('manager.leads.form.per_hour', 6)))->by('lead|'.$request->ip()), Limit::perHour(max(1, (int) config('manager.leads.form.per_hour_all', 120)))->by('lead-all'), ]); RateLimiter::for('manager-leads-token', fn (Request $request) => Limit::perMinute(60)->by((string) $request->ip())); } public function commands(): array { return [LeadsPruneCommand::class]; } public function actions(): array { return [ 'leads.handled' => ['Marked a request as handled or open'], 'leads.note' => ['Added a note to a request'], 'leads.folder' => ['Moved a request to another folder'], 'leads.block' => ['Blocked a sender'], 'leads.unblock' => ['Lifted the block of a sender'], 'leads.destroy' => ['Deleted a request'], ]; } public function views(): array { return ['leads.index' => 'Opened the requests', 'leads.opened' => 'Opened a request']; } }