File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 33namespace Yajra \DataTables \Commands ;
44
55use Illuminate \Console \Command ;
6- use Illuminate \Support \Facades \Storage ;
6+ use Illuminate \Support \Facades \File ;
7+ use Symfony \Component \Finder \SplFileInfo ;
78
89class DataTablesPurgeExportCommand extends Command
910{
@@ -28,10 +29,12 @@ class DataTablesPurgeExportCommand extends Command
2829 */
2930 public function handle ()
3031 {
31- collect (Storage::listContents ('exports ' ))
32- ->each (function ($ file ) {
33- if ($ file ['timestamp ' ] < now ()->subDay (config ('datatables-export.purge.days ' ))->getTimestamp ()) {
34- Storage::delete ($ file ['path ' ]);
32+ $ exportPath = config ('datatables-export.path ' , storage_path ('app/exports ' ));
33+
34+ collect (File::allFiles ($ exportPath ))
35+ ->each (function (SplFileInfo $ file ) {
36+ if ($ file ->getMTime () < now ()->subDay (config ('datatables-export.purge.days ' ))->getTimestamp ()) {
37+ File::delete ($ file ->getRealPath ());
3538 }
3639 });
3740
You can’t perform that action at this time.
0 commit comments