/**
  * @param $form_id
  */
 public function getDownload($form_id)
 {
     Coanda::checkAccess('webforms', 'view');
     try {
         $form = $this->webFormsRepository->getForm($form_id);
         if ($form->download() && $form->download()->available()) {
             return \Response::download($form->download()->filename);
         }
         $file_name = $form->name . '-Submissions-' . date('d-m-Y-H-i-s', time());
         $this->exporter->exportToBrowser($form, $file_name);
         exit;
     } catch (WebFormNotFoundException $exception) {
         App::abort('404');
     }
 }
 /**
  * Creates the CSV file using the CsvExporter
  * 
  * @return
  */
 protected function createCsvFile()
 {
     $form = $this->download->form;
     $file_name = $this->exporter->exportToFile($form, false, [], $this->download->id);
     if ($file_name) {
         $this->setStatusToComplete($file_name);
         return;
     }
     $this->setStatusToFailed();
     return;
 }