Code format

This commit is contained in:
Edward Yang 2023-07-05 09:22:05 +08:00
parent 7e3ee84096
commit 5649d40560
1 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@ class Controller extends \App\Http\Controllers\Controller
*/
public function downloadCsv($filename, $header, $records): mixed
{
if (!str_contains($filename, '.csv')) {
if (! str_contains($filename, '.csv')) {
$filename = $filename . '-' . date('YmdHis') . '.csv';
}
@ -33,6 +33,7 @@ class Controller extends \App\Http\Controllers\Controller
$csv = \League\Csv\Writer::createFromString('');
$csv->insertOne($header);
$csv->insertAll($records);
return response($csv, 200, $headers);
}
}