*/ public function rules(): array { return [ // Validate by extension only — Windows CSV exports arrive with a // variety of MIME types (text/plain, application/vnd.ms-excel), so a // strict `mimes:csv` rule would reject legitimate files. 'file' => [ 'required', 'file', 'max:10240', function (string $attribute, mixed $value, Closure $fail): void { $ext = $value instanceof UploadedFile ? strtolower($value->getClientOriginalExtension()) : ''; if (! in_array($ext, ['csv', 'txt'], true)) { $fail('Bitte eine CSV-Datei (.csv oder .txt) hochladen.'); } }, ], ]; } }