@fleetbase/storefront-engine 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +4 -4
  2. package/addon/components/modals/import-products.hbs +1 -1
  3. package/addon/components/schedule-manager.hbs +2 -2
  4. package/addon/components/widget/customers.hbs +1 -1
  5. package/addon/components/widget/customers.js +7 -4
  6. package/addon/components/widget/orders.js +4 -0
  7. package/addon/controllers/base-controller.js +31 -0
  8. package/addon/controllers/networks/index/network.js +2 -2
  9. package/addon/controllers/networks/index.js +3 -2
  10. package/addon/controllers/products/index/category/new.js +14 -11
  11. package/addon/controllers/products/index/category.js +2 -2
  12. package/addon/controllers/products/index/index.js +2 -2
  13. package/addon/controllers/products/index.js +2 -3
  14. package/addon/models/network.js +0 -1
  15. package/addon/models/product-addon-category.js +10 -1
  16. package/addon/models/product-variant.js +0 -2
  17. package/addon/models/product.js +35 -2
  18. package/addon/routes/customers/index.js +11 -1
  19. package/addon/routes/networks/index.js +9 -0
  20. package/addon/routes/orders/index.js +11 -1
  21. package/addon/routes/products/index.js +8 -2
  22. package/addon/serializers/product.js +16 -0
  23. package/addon/services/storefront.js +81 -0
  24. package/addon/templates/networks/index/network/stores.hbs +2 -2
  25. package/addon/templates/networks/index/network.hbs +1 -1
  26. package/addon/templates/products/index/category/new.hbs +3 -3
  27. package/addon/templates/products/index/category.hbs +20 -3
  28. package/app/controllers/base-controller.js +1 -0
  29. package/assets/sounds/storefront_order_alert.mp3 +0 -0
  30. package/composer.json +3 -3
  31. package/config/environment.js +11 -1
  32. package/extension.json +1 -1
  33. package/index.js +15 -0
  34. package/package.json +132 -125
  35. package/server/src/Auth/Schemas/Storefront.php +31 -39
  36. package/server/src/Console/Commands/NotifyStorefrontOrderNearby.php +9 -11
  37. package/server/src/Expansions/ContactFilterExpansion.php +36 -0
  38. package/server/src/Expansions/EntityExpansion.php +12 -12
  39. package/server/src/Expansions/OrderFilterExpansion.php +31 -0
  40. package/server/src/Expansions/VendorFilterExpansion.php +36 -0
  41. package/server/src/Http/Controllers/ActionController.php +9 -11
  42. package/server/src/Http/Controllers/AddonCategoryController.php +1 -1
  43. package/server/src/Http/Controllers/CustomerController.php +1 -1
  44. package/server/src/Http/Controllers/GatewayController.php +1 -1
  45. package/server/src/Http/Controllers/MetricsController.php +17 -17
  46. package/server/src/Http/Controllers/NetworkController.php +16 -26
  47. package/server/src/Http/Controllers/NotificationChannelController.php +1 -1
  48. package/server/src/Http/Controllers/OrderController.php +18 -22
  49. package/server/src/Http/Controllers/ProductAddonCategoryController.php +1 -2
  50. package/server/src/Http/Controllers/ProductAddonController.php +1 -2
  51. package/server/src/Http/Controllers/ProductController.php +89 -44
  52. package/server/src/Http/Controllers/ProductHourController.php +1 -1
  53. package/server/src/Http/Controllers/ProductVariantController.php +1 -1
  54. package/server/src/Http/Controllers/ProductVariantOptionController.php +1 -1
  55. package/server/src/Http/Controllers/ReviewController.php +1 -1
  56. package/server/src/Http/Controllers/StoreController.php +1 -2
  57. package/server/src/Http/Controllers/StoreHourController.php +1 -1
  58. package/server/src/Http/Controllers/StoreLocationController.php +1 -1
  59. package/server/src/Http/Controllers/StorefrontController.php +0 -2
  60. package/server/src/Http/Controllers/VoteController.php +1 -1
  61. package/server/src/Http/Controllers/v1/CartController.php +16 -26
  62. package/server/src/Http/Controllers/v1/CategoryController.php +3 -4
  63. package/server/src/Http/Controllers/v1/CheckoutController.php +283 -286
  64. package/server/src/Http/Controllers/v1/CustomerController.php +54 -67
  65. package/server/src/Http/Controllers/v1/GatewayControllerController.php +0 -2
  66. package/server/src/Http/Controllers/v1/NetworkController.php +26 -23
  67. package/server/src/Http/Controllers/v1/PaymentMethodController.php +0 -2
  68. package/server/src/Http/Controllers/v1/ProductController.php +1 -4
  69. package/server/src/Http/Controllers/v1/ReviewController.php +31 -35
  70. package/server/src/Http/Controllers/v1/ServiceQuoteController.php +57 -53
  71. package/server/src/Http/Controllers/v1/StoreController.php +8 -16
  72. package/server/src/Http/Filter/AddonCategoryFilter.php +1 -1
  73. package/server/src/Http/Filter/OrderFilter.php +2 -2
  74. package/server/src/Http/Middleware/SetStorefrontSession.php +9 -20
  75. package/server/src/Http/Requests/AddStoreToNetworkCategory.php +3 -3
  76. package/server/src/Http/Requests/CreateCustomerRequest.php +5 -7
  77. package/server/src/Http/Requests/CreateReviewRequest.php +4 -5
  78. package/server/src/Http/Requests/GetServiceQuoteFromCart.php +2 -2
  79. package/server/src/Http/Requests/InitializeCheckoutRequest.php +5 -5
  80. package/server/src/Http/Requests/NetworkActionRequest.php +2 -2
  81. package/server/src/Http/Requests/VerifyCreateCustomerRequest.php +2 -2
  82. package/server/src/Http/Resources/Cart.php +20 -11
  83. package/server/src/Http/Resources/Category.php +12 -11
  84. package/server/src/Http/Resources/Customer.php +15 -14
  85. package/server/src/Http/Resources/Gateway.php +12 -11
  86. package/server/src/Http/Resources/Media.php +9 -8
  87. package/server/src/Http/Resources/Network.php +33 -28
  88. package/server/src/Http/Resources/Product.php +89 -81
  89. package/server/src/Http/Resources/Review.php +14 -13
  90. package/server/src/Http/Resources/ReviewCustomer.php +12 -11
  91. package/server/src/Http/Resources/Store.php +39 -33
  92. package/server/src/Http/Resources/StoreHour.php +9 -8
  93. package/server/src/Http/Resources/StoreLocation.php +9 -9
  94. package/server/src/Imports/ProductsImport.php +0 -2
  95. package/server/src/Jobs/DownloadProductImageUrl.php +7 -4
  96. package/server/src/Listeners/HandleOrderCompleted.php +2 -1
  97. package/server/src/Listeners/HandleOrderDispatched.php +2 -1
  98. package/server/src/Listeners/HandleOrderDriverAssigned.php +2 -1
  99. package/server/src/Listeners/HandleOrderStarted.php +4 -3
  100. package/server/src/Mail/StorefrontNetworkInvite.php +7 -6
  101. package/server/src/Models/AddonCategory.php +2 -4
  102. package/server/src/Models/Cart.php +117 -124
  103. package/server/src/Models/Checkout.php +14 -12
  104. package/server/src/Models/Customer.php +9 -9
  105. package/server/src/Models/Gateway.php +22 -22
  106. package/server/src/Models/Network.php +41 -52
  107. package/server/src/Models/NetworkStore.php +6 -5
  108. package/server/src/Models/NotificationChannel.php +11 -9
  109. package/server/src/Models/PaymentMethod.php +9 -7
  110. package/server/src/Models/Product.php +152 -30
  111. package/server/src/Models/ProductAddon.php +14 -11
  112. package/server/src/Models/ProductAddonCategory.php +9 -8
  113. package/server/src/Models/ProductHour.php +6 -5
  114. package/server/src/Models/ProductStoreLocation.php +7 -5
  115. package/server/src/Models/ProductVariant.php +15 -11
  116. package/server/src/Models/ProductVariantOption.php +12 -9
  117. package/server/src/Models/Review.php +9 -7
  118. package/server/src/Models/Store.php +68 -84
  119. package/server/src/Models/StoreHour.php +6 -5
  120. package/server/src/Models/StoreLocation.php +12 -8
  121. package/server/src/Models/StorefrontModel.php +1 -1
  122. package/server/src/Models/Vote.php +8 -6
  123. package/server/src/Notifications/StorefrontOrderCanceled.php +15 -19
  124. package/server/src/Notifications/StorefrontOrderCompleted.php +15 -19
  125. package/server/src/Notifications/StorefrontOrderCreated.php +31 -36
  126. package/server/src/Notifications/StorefrontOrderDriverAssigned.php +15 -20
  127. package/server/src/Notifications/StorefrontOrderEnroute.php +14 -19
  128. package/server/src/Notifications/StorefrontOrderNearby.php +16 -21
  129. package/server/src/Notifications/StorefrontOrderPreparing.php +15 -18
  130. package/server/src/Notifications/StorefrontOrderReadyForPickup.php +15 -18
  131. package/server/src/Observers/NetworkObserver.php +2 -3
  132. package/server/src/Observers/ProductObserver.php +17 -33
  133. package/server/src/Providers/EventServiceProvider.php +15 -4
  134. package/server/src/Providers/StorefrontServiceProvider.php +8 -10
  135. package/server/src/Support/Metrics.php +12 -12
  136. package/server/src/Support/OrderConfig.php +3 -2
  137. package/server/src/Support/QPay.php +22 -20
  138. package/server/src/Support/Storefront.php +18 -17
  139. package/server/src/routes.php +1 -1
  140. package/tsconfig.declarations.json +10 -0
@@ -10,21 +10,22 @@ class Review extends FleetbaseResource
10
10
  /**
11
11
  * Transform the resource into an array.
12
12
  *
13
- * @param \Illuminate\Http\Request $request
13
+ * @param \Illuminate\Http\Request $request
14
+ *
14
15
  * @return array
15
16
  */
16
17
  public function toArray($request)
17
18
  {
18
19
  return [
19
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
20
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
21
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
22
23
  'subject_id' => $this->subject->id,
23
- 'rating' => $this->rating,
24
- 'content' => $this->content,
25
- 'customer' => new ReviewCustomer($this->customer),
26
- 'slug' => $this->slug,
27
- 'photos' => $this->mapPhotos($this->photos),
24
+ 'rating' => $this->rating,
25
+ 'content' => $this->content,
26
+ 'customer' => new ReviewCustomer($this->customer),
27
+ 'slug' => $this->slug,
28
+ 'photos' => $this->mapPhotos($this->photos),
28
29
  'created_at' => $this->created_at,
29
30
  'updated_at' => $this->updated_at,
30
31
  ];
@@ -34,11 +35,11 @@ class Review extends FleetbaseResource
34
35
  {
35
36
  return collect($photos)->map(function ($photo) {
36
37
  return [
37
- 'id' => $photo->public_id,
38
+ 'id' => $photo->public_id,
38
39
  'filename' => $photo->original_filename,
39
- 'type' => $photo->content_type,
40
- 'caption' => $photo->caption,
41
- 'url' => $photo->url
40
+ 'type' => $photo->content_type,
41
+ 'caption' => $photo->caption,
42
+ 'url' => $photo->url,
42
43
  ];
43
44
  });
44
45
  }
@@ -11,24 +11,25 @@ class ReviewCustomer extends FleetbaseResource
11
11
  /**
12
12
  * Transform the resource into an array.
13
13
  *
14
- * @param \Illuminate\Http\Request $request
14
+ * @param \Illuminate\Http\Request $request
15
+ *
15
16
  * @return array
16
17
  */
17
18
  public function toArray($request)
18
19
  {
19
20
  return [
20
- 'id' => $this->when(Http::isInternalRequest(), $this->id, Str::replaceFirst('contact', 'customer', $this->public_id)),
21
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
23
- 'name' => $this->name,
24
- 'email' => $this->email,
25
- 'phone' => $this->phone,
26
- 'photo_url' => $this->photo_url,
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, Str::replaceFirst('contact', 'customer', $this->public_id)),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'name' => $this->name,
25
+ 'email' => $this->email,
26
+ 'phone' => $this->phone,
27
+ 'photo_url' => $this->photo_url,
27
28
  'reviews_count' => $this->getReviewsCount(),
28
29
  'uploads_count' => $this->getUploadsCount(),
29
- 'slug' => $this->slug,
30
- 'created_at' => $this->created_at,
31
- 'updated_at' => $this->updated_at,
30
+ 'slug' => $this->slug,
31
+ 'created_at' => $this->created_at,
32
+ 'updated_at' => $this->updated_at,
32
33
  ];
33
34
  }
34
35
 
@@ -10,49 +10,55 @@ class Store extends FleetbaseResource
10
10
  /**
11
11
  * Transform the resource into an array.
12
12
  *
13
- * @param \Illuminate\Http\Request $request
13
+ * @param \Illuminate\Http\Request $request
14
+ *
14
15
  * @return array
15
16
  */
16
17
  public function toArray($request)
17
18
  {
18
19
  return [
19
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
20
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
21
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
22
- 'key' => $this->when(Http::isInternalRequest(), $this->key),
23
- 'name' => $this->name,
24
- 'description' => $this->description,
25
- 'translations' => $this->translations ?? [],
26
- 'website' => $this->website,
27
- 'facebook' => $this->facebook,
28
- 'instagram' => $this->instagram,
29
- 'twitter' => $this->twitter,
30
- 'email' => $this->email,
31
- 'phone' => $this->phone,
32
- 'tags' => $this->tags ?? [],
33
- 'currency' => $this->currency ?? 'USD',
34
- 'options' => $this->formatOptions($this->options),
35
- 'logo_url' => $this->logo_url,
36
- 'backdrop_url' => $this->backdrop_url,
37
- 'rating' => $this->rating,
38
- 'online' => $this->online,
39
- 'is_network' => false,
40
- 'is_store' => true,
41
- 'category' => $this->when($request->filled('network') && $request->has('with_category'), new Category($this->getNetworkCategoryUsingId($request->input('network')))),
42
- 'networks' => $this->when($request->boolean('with_networks') || $request->inArray('with', 'networks'), Network::collection($this->networks)),
43
- 'locations' => $this->when($request->boolean('with_locations'), $this->locations->mapInto(StoreLocation::class)),
44
- 'media' => $this->when($request->boolean('with_media'), Media::collection($this->media)),
45
- 'slug' => $this->slug,
46
- 'created_at' => $this->created_at,
47
- 'updated_at' => $this->updated_at,
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
23
+ 'key' => $this->when(Http::isInternalRequest(), $this->key),
24
+ 'company_uuid' => $this->when(Http::isInternalRequest(), $this->company_uuid),
25
+ 'created_by_uuid' => $this->when(Http::isInternalRequest(), $this->created_by_uuid),
26
+ 'logo_uuid' => $this->when(Http::isInternalRequest(), $this->logo_uuid),
27
+ 'backdrop_uuid' => $this->when(Http::isInternalRequest(), $this->backdrop_uuid),
28
+ 'name' => $this->name,
29
+ 'description' => $this->description,
30
+ 'translations' => $this->translations ?? [],
31
+ 'website' => $this->website,
32
+ 'facebook' => $this->facebook,
33
+ 'instagram' => $this->instagram,
34
+ 'twitter' => $this->twitter,
35
+ 'email' => $this->email,
36
+ 'phone' => $this->phone,
37
+ 'tags' => $this->tags ?? [],
38
+ 'currency' => $this->currency ?? 'USD',
39
+ 'options' => $this->formatOptions($this->options),
40
+ 'logo_url' => $this->logo_url,
41
+ 'backdrop_url' => $this->backdrop_url,
42
+ 'rating' => $this->rating,
43
+ 'online' => $this->online,
44
+ 'is_network' => false,
45
+ 'is_store' => true,
46
+ 'category' => $this->when($request->filled('network') && $request->has('with_category'), new Category($this->getNetworkCategoryUsingId($request->input('network')))),
47
+ 'networks' => $this->when($request->boolean('with_networks') || $request->inArray('with', 'networks'), Network::collection($this->networks)),
48
+ 'locations' => $this->when($request->boolean('with_locations'), $this->locations->mapInto(StoreLocation::class)),
49
+ 'media' => $this->when($request->boolean('with_media'), Media::collection($this->media)),
50
+ 'slug' => $this->slug,
51
+ 'created_at' => $this->created_at,
52
+ 'updated_at' => $this->updated_at,
48
53
  ];
49
54
  }
50
55
 
51
56
  /**
52
57
  * Format the given options array by removing excluded keys.
53
58
  *
54
- * @param mixed $options The options array to format.
55
- * @return array The formatted options array.
59
+ * @param mixed $options the options array to format
60
+ *
61
+ * @return array the formatted options array
56
62
  */
57
63
  public function formatOptions($options = []): array
58
64
  {
@@ -61,7 +67,7 @@ class Store extends FleetbaseResource
61
67
  }
62
68
 
63
69
  $formattedOptions = [];
64
- $exclude = ['alerted_for_new_order'];
70
+ $exclude = ['alerted_for_new_order'];
65
71
 
66
72
  foreach ($options as $key => $value) {
67
73
  if (in_array($key, $exclude)) {
@@ -10,20 +10,21 @@ class StoreHour extends FleetbaseResource
10
10
  /**
11
11
  * Transform the resource into an array.
12
12
  *
13
- * @param \Illuminate\Http\Request $request
13
+ * @param \Illuminate\Http\Request $request
14
+ *
14
15
  * @return array
15
16
  */
16
17
  public function toArray($request)
17
18
  {
18
19
  return [
19
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
20
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
21
22
  'day_of_week' => $this->when(Http::isInternalRequest(), $this->day_of_week),
22
- 'day' => $this->day_of_week,
23
- 'start' => $this->start,
24
- 'end' => $this->end,
25
- 'created_at' => $this->when(Http::isInternalRequest(), $this->created_at),
26
- 'updated_at' => $this->when(Http::isInternalRequest(), $this->updated_at),
23
+ 'day' => $this->day_of_week,
24
+ 'start' => $this->start,
25
+ 'end' => $this->end,
26
+ 'created_at' => $this->when(Http::isInternalRequest(), $this->created_at),
27
+ 'updated_at' => $this->when(Http::isInternalRequest(), $this->updated_at),
27
28
  ];
28
29
  }
29
30
  }
@@ -3,7 +3,6 @@
3
3
  namespace Fleetbase\Storefront\Http\Resources;
4
4
 
5
5
  use Fleetbase\FleetOps\Http\Resources\v1\Place;
6
- use Fleetbase\FleetOps\Http\Resources\Internal\v1\Place as InternalPlace;
7
6
  use Fleetbase\Http\Resources\FleetbaseResource;
8
7
  use Fleetbase\Support\Http;
9
8
 
@@ -12,20 +11,21 @@ class StoreLocation extends FleetbaseResource
12
11
  /**
13
12
  * Transform the resource into an array.
14
13
  *
15
- * @param \Illuminate\Http\Request $request
14
+ * @param \Illuminate\Http\Request $request
15
+ *
16
16
  * @return array
17
17
  */
18
18
  public function toArray($request)
19
19
  {
20
20
  return [
21
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
- 'store' => data_get($this, 'store.public_id'),
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'store' => data_get($this, 'store.public_id'),
25
25
  'store_data' => $this->when($request->boolean('with_store'), new Store($this->store)),
26
- 'name' => $this->name,
27
- 'place' => $this->when(Http::isInternalRequest(), new InternalPlace($this->place), new Place($this->place)),
28
- 'hours' => StoreHour::collection($this->hours),
26
+ 'name' => $this->name,
27
+ 'place' => $this->place ? new Place($this->place) : null,
28
+ 'hours' => StoreHour::collection($this->hours),
29
29
  'created_at' => $this->created_at,
30
30
  'updated_at' => $this->updated_at,
31
31
  ];
@@ -9,8 +9,6 @@ use Maatwebsite\Excel\Concerns\WithHeadingRow;
9
9
  class ProductsImport implements ToCollection, WithHeadingRow
10
10
  {
11
11
  /**
12
- * @param array $row
13
- *
14
12
  * @return \Illuminate\Support\Collection
15
13
  */
16
14
  public function collection(Collection $rows)
@@ -2,9 +2,9 @@
2
2
 
3
3
  namespace Fleetbase\Storefront\Jobs;
4
4
 
5
- use Fleetbase\Storefront\Models\Product;
6
- use Fleetbase\Models\File;
7
5
  use Fleetbase\FleetOps\Support\Utils;
6
+ use Fleetbase\Models\File;
7
+ use Fleetbase\Storefront\Models\Product;
8
8
  use Illuminate\Bus\Queueable;
9
9
  use Illuminate\Contracts\Queue\ShouldQueue;
10
10
  use Illuminate\Foundation\Bus\Dispatchable;
@@ -13,7 +13,10 @@ use Illuminate\Queue\SerializesModels;
13
13
 
14
14
  class DownloadProductImageUrl implements ShouldQueue
15
15
  {
16
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
16
+ use Dispatchable;
17
+ use InteractsWithQueue;
18
+ use Queueable;
19
+ use SerializesModels;
17
20
 
18
21
  /**
19
22
  * The uuid of the product.
@@ -37,7 +40,7 @@ class DownloadProductImageUrl implements ShouldQueue
37
40
  public function __construct(Product $product, string $url)
38
41
  {
39
42
  $this->product = $product->uuid;
40
- $this->url = $url;
43
+ $this->url = $url;
41
44
  }
42
45
 
43
46
  /**
@@ -14,7 +14,8 @@ class HandleOrderCompleted implements ShouldQueue
14
14
  /**
15
15
  * Handle the event.
16
16
  *
17
- * @param object $event
17
+ * @param object $event
18
+ *
18
19
  * @return void
19
20
  */
20
21
  public function handle(OrderCompleted $event)
@@ -14,7 +14,8 @@ class HandleOrderDispatched implements ShouldQueue
14
14
  /**
15
15
  * Handle the event.
16
16
  *
17
- * @param object $event
17
+ * @param object $event
18
+ *
18
19
  * @return void
19
20
  */
20
21
  public function handle(OrderDispatched $event)
@@ -15,7 +15,8 @@ class HandleOrderDriverAssigned implements ShouldQueue
15
15
  /**
16
16
  * Handle the event.
17
17
  *
18
- * @param object $event
18
+ * @param object $event
19
+ *
19
20
  * @return void
20
21
  */
21
22
  public function handle(OrderDriverAssigned $event)
@@ -10,7 +10,8 @@ class HandleOrderStarted
10
10
  /**
11
11
  * Handle the event.
12
12
  *
13
- * @param object $event
13
+ * @param object $event
14
+ *
14
15
  * @return void
15
16
  */
16
17
  public function handle(OrderStarted $event)
@@ -18,8 +19,8 @@ class HandleOrderStarted
18
19
  /** @var \Fleetbase\FleetOps\Models\Order $order */
19
20
  $order = $event->getModelRecord();
20
21
 
21
- // if storefront order / notify customer driver has started and is en-route
22
- if ($order->hasMeta('storefront_id')) {
22
+ // if storefront order / notify customer driver has started and is en-route
23
+ if ($order->hasMeta('storefront_id')) {
23
24
  $order->load(['customer']);
24
25
  $order->customer->notify(new StorefrontOrderEnroute($order));
25
26
  }
@@ -2,17 +2,18 @@
2
2
 
3
3
  namespace Fleetbase\Storefront\Mail;
4
4
 
5
- use Fleetbase\Storefront\Models\Network;
5
+ use Fleetbase\FleetOps\Support\Utils;
6
6
  use Fleetbase\Models\Invite;
7
7
  use Fleetbase\Models\User;
8
- use Fleetbase\FleetOps\Support\Utils;
8
+ use Fleetbase\Storefront\Models\Network;
9
9
  use Illuminate\Bus\Queueable;
10
10
  use Illuminate\Mail\Mailable;
11
11
  use Illuminate\Queue\SerializesModels;
12
12
 
13
13
  class StorefrontNetworkInvite extends Mailable
14
14
  {
15
- use Queueable, SerializesModels;
15
+ use Queueable;
16
+ use SerializesModels;
16
17
 
17
18
  public Invite $invite;
18
19
  public Network $network;
@@ -26,10 +27,10 @@ class StorefrontNetworkInvite extends Mailable
26
27
  */
27
28
  public function __construct(Invite $invite)
28
29
  {
29
- $this->invite = $invite;
30
+ $this->invite = $invite;
30
31
  $this->network = $this->invite->subject;
31
- $this->sender = $this->invite->createdBy;
32
- $this->url = Utils::consoleUrl('join/network/' . $this->invite->uri);
32
+ $this->sender = $this->invite->createdBy;
33
+ $this->url = Utils::consoleUrl('join/network/' . $this->invite->uri);
33
34
  }
34
35
 
35
36
  /**
@@ -7,16 +7,14 @@ use Fleetbase\Models\Category;
7
7
  class AddonCategory extends Category
8
8
  {
9
9
  /**
10
- * Relationships to auto load with driver
10
+ * Relationships to auto load with driver.
11
11
  *
12
12
  * @var array
13
13
  */
14
14
  protected $with = ['addons'];
15
15
 
16
16
  /**
17
- * The key to use in the payload responses
18
- *
19
- * @var string
17
+ * The key to use in the payload responses.
20
18
  */
21
19
  protected string $payloadKey = 'addon_category';
22
20