File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff 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! ' );
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments