File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use DuncanMcClean \SimpleCommerce \Facades \Order ;
66use DuncanMcClean \SimpleCommerce \Orders \OrderStatus ;
7+ use DuncanMcClean \SimpleCommerce \SimpleCommerce ;
78use Illuminate \Console \Command ;
89use Illuminate \Support \Carbon ;
910use Statamic \Console \RunsInPlease ;
@@ -20,9 +21,15 @@ public function handle()
2021 {
2122 $ this ->info ('Cleaning up.. ' );
2223
24+ $ fourteenDaysFromNow = Carbon::now ()->subDays (14 );
25+
26+ if ($ this ->isOrExtendsClass (SimpleCommerce::orderDriver ()['repository ' ], \DuncanMcClean \SimpleCommerce \Orders \EntryOrderRepository::class)) {
27+ $ fourteenDaysFromNow = $ fourteenDaysFromNow ->timestamp ;
28+ }
29+
2330 Order::query ()
2431 ->whereOrderStatus (OrderStatus::Cart)
25- ->where ('updated_at ' , '<= ' , Carbon:: now ()-> subDays ( 14 )-> timestamp )
32+ ->where ('updated_at ' , '<= ' , $ fourteenDaysFromNow )
2633 ->chunk (100 , function ($ orders ) {
2734 $ orders ->each (function ($ order ) {
2835 $ this ->line ("Deleting Order: {$ order ->id ()}" );
You can’t perform that action at this time.
0 commit comments