You've already forked pilot-sdk
fix file download
This commit is contained in:
@@ -23,12 +23,13 @@ abstract class Action extends Entity
|
||||
}
|
||||
|
||||
public function file(
|
||||
string $contents,
|
||||
string $path,
|
||||
string $name = '',
|
||||
string $type = ''
|
||||
string $type = '',
|
||||
bool $deleteAfterDownload = false,
|
||||
) {
|
||||
return [
|
||||
'file' => compact('contents', 'name', 'type'),
|
||||
'file' => compact('path', 'name', 'type', 'deleteAfterDownload'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ class PilotServiceProvider extends ServiceProvider
|
||||
|
||||
if (isset($output['file'])) {
|
||||
return response()->download(
|
||||
$output['file']['contents'],
|
||||
$output['file']['name'],
|
||||
[
|
||||
$output['file']['path'],
|
||||
$output['file']['name'] ?? null,
|
||||
! empty($output['file']['type']) ? [
|
||||
'Content-Type' => $output['file']['type'],
|
||||
]
|
||||
);
|
||||
] : []
|
||||
)->deleteFileAfterSend(isset($output['file']['deleteAfterDownload']) ? $output['file']['deleteAfterDownload'] : false);
|
||||
}
|
||||
|
||||
return response();
|
||||
|
||||
Reference in New Issue
Block a user