label('Request Erasure') ->icon('heroicon-o-shield-exclamation') ->color('danger') ->requiresConfirmation() ->modalDescription('Opens a cancellable grace-period erasure request for this Customer account. No linked User\'s login is affected.') ->form([ Checkbox::make('immediate') ->label('Erase immediately (skip the 30-day grace period)') ->helperText('Staff-only, for a formal legal request or regulator inquiry that genuinely requires urgency — not a routine deletion. Runs synchronously, cannot be cancelled once submitted.') ->default(false), ]) ->action(function (Customer $record, array $data) { $privacyService = app(PrivacyService::class); if ($data['immediate']) { $privacyService->requestImmediateErasureForCustomer($record, $this->currentStaff()); Notification::make() ->title('Customer erased') ->body('Erasure ran immediately — see the Erasure Requests list for the outcome.') ->success() ->send(); return; } $privacyService->requestErasureForCustomer($record, $this->currentStaff()); Notification::make() ->title('Erasure requested') ->body('The grace period starts now — see the Erasure Requests list.') ->success() ->send(); }), Action::make('requestExport') ->label('Request Export') ->icon('heroicon-o-arrow-down-tray') ->requiresConfirmation() ->action(function (Customer $record) { app(PrivacyService::class)->requestExportForCustomer($record); Notification::make() ->title('Export requested') ->body('Generating in the background — see the Export Requests list once it completes.') ->success() ->send(); }), ]; } private function currentStaff(): Staff { return auth('staff')->user(); } }