Skip to content

Commit c014e2f

Browse files
author
rtrenuela
committed
Fix Code Style, remove construct and set 1 day old file to be purged.
1 parent 26cb4da commit c014e2f

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/Commands/DataTablesPurgeExportCommand.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ class DataTablesPurgeExportCommand extends Command
2121
*/
2222
protected $description = 'Remove exported files that datatables-export generate.';
2323

24-
/**
25-
* Create a new command instance.
26-
*
27-
* @return void
28-
*/
29-
public function __construct()
30-
{
31-
parent::__construct();
32-
}
33-
3424
/**
3525
* Execute the console command.
3626
*
@@ -40,7 +30,9 @@ public function handle()
4030
{
4131
collect(Storage::listContents('exports'))
4232
->each(function ($file) {
43-
Storage::delete($file['path']);
33+
if ($file['timestamp'] < now()->subDay(1)->getTimestamp()) {
34+
Storage::delete($file['path']);
35+
}
4436
});
4537

4638
$this->info('The command was successful. Export files are cleared!');

src/ExportServiceProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ public function register()
5050
{
5151
$this->mergeConfigFrom(__DIR__ . '/config/datatables-export.php', 'datatables-export');
5252

53-
$this->commands(
54-
[
55-
DataTablesPurgeExportCommand::class,
56-
]
57-
);
53+
$this->commands([ataTablesPurgeExportCommand::class]);
5854
}
5955
}

0 commit comments

Comments
 (0)