insertOne($form->getFields()->names()); foreach ($form->participants as $participant) { $csv->insertOne($participant->getFields()->presentValues()); } return $csv->toString(); } public function asController(Form $form, ActionRequest $request): StreamedResponse { $contents = $this->handle($form); $filename = 'tn-' . $form->slug . '.csv'; Storage::disk('temp')->put($filename, $contents); return Storage::disk('temp')->download($filename); } }