PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.23
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.23
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / app / Events / Order / RenewalOrderDeleted.php

RenewalOrderDeleted.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.23, at app/Events/Order/RenewalOrderDeleted.php

52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Events\Order;
4
5 use FluentCart\App\Events\EventDispatcher;
6 use FluentCart\App\Listeners;
7 use FluentCart\App\Models\Customer;
8 use FluentCart\App\Models\Order;
9
10 class RenewalOrderDeleted extends EventDispatcher
11 {
12 public string $hook = 'fluent_cart/renewal_order_deleted';
13
14 protected array $listeners = [
15 // Listeners\UpdateStock::class,
16 Listeners\Order\RenewalOrderDeleted::class
17 ];
18
19 /**
20 * @var $order Order
21 */
22 public Order $order;
23
24 /**
25 * @var $customer Customer|null
26 */
27
28 public function __construct(Order $order)
29 {
30 $this->order = $order;
31 $this->order->loadMissing('customer', 'shipping_address', 'billing_address');
32 }
33
34 public function toArray(): array
35 {
36 return [
37 'order' => $this->order,
38 'customer' => $this->order->customer ?? [],
39 ];
40 }
41
42 public function getActivityEventModel()
43 {
44 return $this->order;
45 }
46
47 public function shouldCreateActivity(): bool
48 {
49 return $this->order->mode !== \FluentCart\App\Helpers\Status::ORDER_MODE_TEST;
50 }
51 }
52