wip
This commit is contained in:
@@ -60,7 +60,12 @@ class DownloadCardTransaction extends Action
|
|||||||
return ActionResponse::danger($data->message);
|
return ActionResponse::danger($data->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->generateFile($data);
|
$unique_folder_id = Str::snake($model->created_at->toDateTimeString());
|
||||||
|
$fileDest = public_path("files/{$unique_folder_id}/{$model->id}.pdf");
|
||||||
|
|
||||||
|
$this->generateFile($data, $fileDest);
|
||||||
|
|
||||||
|
return ActionResponse::openInNewTab(url("files/{$unique_folder_id}/{$model->id}.pdf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,8 +133,9 @@ class DownloadCardTransaction extends Action
|
|||||||
* Generate file
|
* Generate file
|
||||||
*
|
*
|
||||||
* @param ResponseTypes\AzatApiClientInfoAllResponse $data
|
* @param ResponseTypes\AzatApiClientInfoAllResponse $data
|
||||||
|
* @param string $fileDest
|
||||||
*/
|
*/
|
||||||
public function generateFile($data)
|
public function generateFile($data, $fileDest)
|
||||||
{
|
{
|
||||||
$mpdf = new Mpdf;
|
$mpdf = new Mpdf;
|
||||||
|
|
||||||
@@ -141,6 +147,6 @@ class DownloadCardTransaction extends Action
|
|||||||
$mpdf->WriteHTML($html);
|
$mpdf->WriteHTML($html);
|
||||||
|
|
||||||
// Save the PDF to a file
|
// Save the PDF to a file
|
||||||
$mpdf->Output(public_path('files/output.pdf'), \Mpdf\Output\Destination::FILE);
|
$mpdf->Output($fileDest, \Mpdf\Output\Destination::FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user