Closed damsfx closed 8 months ago
According to the documentation, this is what I use to delete old "New" orders that are not payed :
Event::listen('offline.gdpr::cleanup.register', function () { return [ 'id' => 'acme-mall-plugin', 'label' => 'Acme Mall', 'models' => [ [ 'id' => 'acme-mall-old-orders', 'label' => 'Orders', 'comment' => 'Delete unpaid orders', 'closure' => function ($deadline, $keepDays) { Order::where('created_at', '<', $deadline) ->withTrashed() ->whereHas('order_state', function ($q) { $q->where('flag', OrderState::FLAG_NEW); }) ->where('payment_state', 'OFFLINE\Mall\Classes\PaymentState\PendingState') ->get() ->each(function (Order $order) { DB::transaction(function () use ($order) { $order->forceDelete(); }); }); }, ], ], ]; });
It throw an error : Undefined array key "class" on CleanupService.php. In this case the $model array didn't have any class property!
Undefined array key "class"
CleanupService.php
$model
class
According to the documentation, this is what I use to delete old "New" orders that are not payed :
It throw an error :
Undefined array key "class"
onCleanupService.php
.In this case the
$model
array didn't have anyclass
property!