Skip to content

Commit 837c4f9

Browse files
author
rtrenuela
committed
create config for purge by days old files
1 parent d930ad8 commit 837c4f9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Commands/DataTablesPurgeExportCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function handle()
3030
{
3131
collect(Storage::listContents('exports'))
3232
->each(function ($file) {
33-
if ($file['timestamp'] < now()->subDay(1)->getTimestamp()) {
33+
if ($file['timestamp'] < now()->subDay(config('datatables-export.purge.days'))->getTimestamp()) {
3434
Storage::delete($file['path']);
3535
}
3636
});

src/config/datatables-export.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,12 @@
3535
NumberFormat::FORMAT_DATE_XLSX17,
3636
NumberFormat::FORMAT_DATE_YYYYMMDD2,
3737
NumberFormat::FORMAT_DATE_YYYYMMDDSLASH,
38-
]
38+
],
39+
40+
/**
41+
* Purge all exported by purge.days old files.
42+
*/
43+
'purge' => [
44+
'days' => 1,
45+
],
3946
];

0 commit comments

Comments
 (0)