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 3
3
namespace Yajra \DataTables \Commands ;
4
4
5
5
use Illuminate \Console \Command ;
6
- use Illuminate \Support \Facades \Storage ;
6
+ use Illuminate \Support \Facades \File ;
7
+ use Symfony \Component \Finder \SplFileInfo ;
7
8
8
9
class DataTablesPurgeExportCommand extends Command
9
10
{
@@ -28,10 +29,12 @@ class DataTablesPurgeExportCommand extends Command
28
29
*/
29
30
public function handle ()
30
31
{
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 ());
35
38
}
36
39
});
37
40
You can’t perform that action at this time.
0 commit comments