@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
@@ -3,32 +3,38 @@
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
+ use Fleetbase\FleetOps\Support\Utils;
6
7
  use Fleetbase\Models\Category;
7
8
  use Fleetbase\Models\File;
8
9
  use Fleetbase\Models\User;
9
- use Fleetbase\FleetOps\Support\Utils;
10
- use Fleetbase\Traits\HasMetaAttributes;
11
- use Fleetbase\Traits\HasUuid;
12
10
  use Fleetbase\Traits\HasApiModelBehavior;
11
+ use Fleetbase\Traits\HasMetaAttributes;
13
12
  use Fleetbase\Traits\HasPublicid;
13
+ use Fleetbase\Traits\HasUuid;
14
14
  use Fleetbase\Traits\Searchable;
15
+ use Illuminate\Support\Arr;
15
16
  use Illuminate\Support\Str;
17
+ use Milon\Barcode\Facades\DNS2DFacade as DNS2D;
16
18
  use Spatie\Sluggable\HasSlug;
17
19
  use Spatie\Sluggable\SlugOptions;
18
- use Milon\Barcode\Facades\DNS2DFacade as DNS2D;
19
20
 
20
21
  class ProductStatus
21
22
  {
22
23
  public const AVAILABLE = 'available';
23
- public const DRAFT = 'draft';
24
+ public const DRAFT = 'draft';
24
25
  }
25
26
 
26
27
  class Product extends StorefrontModel
27
28
  {
28
- use HasUuid, HasPublicid, HasApiModelBehavior, HasMetaAttributes, HasSlug, Searchable;
29
+ use HasUuid;
30
+ use HasPublicid;
31
+ use HasApiModelBehavior;
32
+ use HasMetaAttributes;
33
+ use HasSlug;
34
+ use Searchable;
29
35
 
30
36
  /**
31
- * The type of public Id to generate
37
+ * The type of public Id to generate.
32
38
  *
33
39
  * @var string
34
40
  */
@@ -42,7 +48,7 @@ class Product extends StorefrontModel
42
48
  protected $table = 'products';
43
49
 
44
50
  /**
45
- * These attributes that can be queried
51
+ * These attributes that can be queried.
46
52
  *
47
53
  * @var array
48
54
  */
@@ -78,7 +84,7 @@ class Product extends StorefrontModel
78
84
  'is_recommended',
79
85
  'can_pickup',
80
86
  'status',
81
- 'slug'
87
+ 'slug',
82
88
  ];
83
89
 
84
90
  /**
@@ -87,27 +93,27 @@ class Product extends StorefrontModel
87
93
  * @var array
88
94
  */
89
95
  protected $casts = [
90
- 'is_service' => 'boolean',
91
- 'is_bookable' => 'boolean',
92
- 'is_on_sale' => 'boolean',
93
- 'is_available' => 'boolean',
96
+ 'is_service' => 'boolean',
97
+ 'is_bookable' => 'boolean',
98
+ 'is_on_sale' => 'boolean',
99
+ 'is_available' => 'boolean',
94
100
  'is_recommended' => 'boolean',
95
- 'can_pickup' => 'boolean',
96
- 'tags' => 'array',
97
- 'meta' => Json::class,
98
- 'translations' => Json::class,
99
- 'youtube_urls' => Json::class
101
+ 'can_pickup' => 'boolean',
102
+ 'tags' => 'array',
103
+ 'meta' => Json::class,
104
+ 'translations' => Json::class,
105
+ 'youtube_urls' => Json::class,
100
106
  ];
101
107
 
102
108
  /**
103
- * Dynamic attributes that are appended to object
109
+ * Dynamic attributes that are appended to object.
104
110
  *
105
111
  * @var array
106
112
  */
107
113
  protected $appends = ['primary_image_url', 'store_id', 'meta_array'];
108
114
 
109
115
  /**
110
- * Attributes that is filterable on this model
116
+ * Attributes that is filterable on this model.
111
117
  *
112
118
  * @var array
113
119
  */
@@ -230,9 +236,9 @@ class Product extends StorefrontModel
230
236
 
231
237
  foreach ($this->meta as $key => $value) {
232
238
  $_meta[] = [
233
- 'key' => Str::snake($key),
239
+ 'key' => Str::snake($key),
234
240
  'label' => Utils::smartHumanize($key),
235
- 'value' => $value
241
+ 'value' => $value,
236
242
  ];
237
243
  }
238
244
 
@@ -244,9 +250,9 @@ class Product extends StorefrontModel
244
250
  */
245
251
  public function getPrimaryImageUrlAttribute()
246
252
  {
247
- $default = $this->primaryImage->url ?? null;
253
+ $default = $this->primaryImage->url ?? null;
248
254
  $secondary = $this->files->first()->url ?? null;
249
- $backup = 'https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/image-file-icon.png';
255
+ $backup = 'https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/image-file-icon.png';
250
256
 
251
257
  return $default ?? $secondary ?? $backup;
252
258
  }
@@ -262,7 +268,7 @@ class Product extends StorefrontModel
262
268
  }
263
269
 
264
270
  /**
265
- * Set the price as only numbers
271
+ * Set the price as only numbers.
266
272
  *
267
273
  * @void
268
274
  */
@@ -272,7 +278,7 @@ class Product extends StorefrontModel
272
278
  }
273
279
 
274
280
  /**
275
- * Set the sale price as only numbers
281
+ * Set the sale price as only numbers.
276
282
  *
277
283
  * @void
278
284
  */
@@ -281,15 +287,131 @@ class Product extends StorefrontModel
281
287
  $this->attributes['sale_price'] = Utils::numbersOnly($value);
282
288
  }
283
289
 
290
+ /**
291
+ * Sets or updates addon categories for the product.
292
+ *
293
+ * This function iterates over each addon category in the given array. If the category exists (identified by UUID),
294
+ * it updates the existing category. Otherwise, it creates a new category and adds it to the product.
295
+ *
296
+ * @param array $addonCategories An array of addon categories data. Each category should have keys like 'uuid',
297
+ * 'excluded_addons', 'max_selectable', and 'is_required'.
298
+ *
299
+ * @return Product returns the instance of the Product for method chaining
300
+ */
301
+ public function setAddonCategories(array $addonCategories = []): Product
302
+ {
303
+ foreach ($addonCategories as $addonCategory) {
304
+ // get uuid if set
305
+ $id = data_get($addonCategory, 'uuid');
306
+
307
+ // update product addon category
308
+ if (Str::isUuid($id)) {
309
+ ProductAddonCategory::where('uuid', $id)->update([
310
+ 'excluded_addons' => data_get($addonCategory, 'excluded_addons'),
311
+ 'max_selectable' => data_get($addonCategory, 'max_selectable'),
312
+ 'is_required' => data_get($addonCategory, 'is_required'),
313
+ ]);
314
+ continue;
315
+ }
316
+
317
+ // create new product addon category
318
+ $productAddonCategory = ProductAddonCategory::create([
319
+ 'product_uuid' => $this->uuid,
320
+ 'category_uuid' => data_get($addonCategory, 'category_uuid'),
321
+ 'excluded_addons' => data_get($addonCategory, 'excluded_addons'),
322
+ 'max_selectable' => data_get($addonCategory, 'max_selectable'),
323
+ 'is_required' => data_get($addonCategory, 'is_required'),
324
+ ]);
325
+
326
+ // insert to hasmany relation
327
+ $this->addonCategories->push($productAddonCategory);
328
+ }
329
+
330
+ return $this;
331
+ }
332
+
333
+ /**
334
+ * Sets or updates product variants for the product.
335
+ *
336
+ * Iterates through each variant in the provided array. If the variant exists (identified by UUID), it updates
337
+ * the variant with new values. If it doesn't exist, a new variant is created. Also handles the setting or
338
+ * updating of product variant options.
339
+ *
340
+ * @param array $variants An array of product variants data. Each variant should have keys like 'uuid', 'name',
341
+ * 'description', 'translations', 'meta', 'is_multiselect', 'is_required', 'min', 'max',
342
+ * and 'options'.
343
+ *
344
+ * @return Product returns the instance of the Product for method chaining
345
+ */
346
+ public function setProductVariants(array $variants = []): Product
347
+ {
348
+ foreach ($variants as $variant) {
349
+ $id = data_get($variant, 'uuid');
350
+
351
+ if (Str::isUuid($id)) {
352
+ // Update the existing product variant with new values if any changed
353
+ ProductVariant::where('uuid', $id)->update([
354
+ 'name' => data_get($variant, 'name'),
355
+ 'description' => data_get($variant, 'name'),
356
+ 'translations' => data_get($variant, 'translations', []),
357
+ 'meta' => data_get($variant, 'meta', []),
358
+ 'is_multiselect' => data_get($variant, 'is_multiselect'),
359
+ 'is_required' => data_get($variant, 'is_required'),
360
+ 'min' => data_get($variant, 'min'),
361
+ 'max' => data_get($variant, 'max'),
362
+ ]);
363
+
364
+ // Update product variant options if applicable
365
+ if (is_array($variant['options'])) {
366
+ foreach ($variant['options'] as $option) {
367
+ $optionId = data_get($option, 'uuid');
368
+
369
+ if (Str::isUuid($optionId)) {
370
+ // make sure additional cost is always numbers only
371
+ if (isset($option['additional_cost'])) {
372
+ $option['additional_cost'] = Utils::numbersOnly($option['additional_cost']);
373
+ }
374
+
375
+ $productVariantOptionInput = Arr::except($option, ['uuid']);
376
+ ProductVariantOption::where('uuid', $option['uuid'])->update($productVariantOptionInput);
377
+ continue;
378
+ }
379
+
380
+ $option['product_variant_uuid'] = $id;
381
+ ProductVariantOption::create($option);
382
+ }
383
+ }
384
+
385
+ continue;
386
+ }
387
+
388
+ $variant['created_by_uuid'] = session('user');
389
+ $variant['company_uuid'] = session('company');
390
+ $variant['product_uuid'] = $this->uuid;
391
+
392
+ $productVariantInput = Arr::except($variant, ['options']);
393
+ $productVariant = ProductVariant::create($productVariantInput);
394
+
395
+ if (is_array($variant['options'])) {
396
+ foreach ($variant['options'] as $option) {
397
+ $option['product_variant_uuid'] = $productVariant->uuid;
398
+ ProductVariantOption::create($option);
399
+ }
400
+ }
401
+ }
402
+
403
+ return $this;
404
+ }
405
+
284
406
  /**
285
407
  * Finds products that match the specified search query, store, and network.
286
408
  *
287
- * @param string $search The search query to use to find products.
288
- * @param string|null $store The store to search for products in. If null, all stores are searched.
289
- * @param int $limit The maximum number of products to return.
409
+ * @param string $search the search query to use to find products
410
+ * @param string|null $store The store to search for products in. If null, all stores are searched.
411
+ * @param int $limit the maximum number of products to return
290
412
  * @param string|null $network The network to search for products on. If null, the session network is used.
291
413
  *
292
- * @return \Illuminate\Database\Eloquent\Collection The collection of products that match the search query, store, and network.
414
+ * @return \Illuminate\Database\Eloquent\Collection the collection of products that match the search query, store, and network
293
415
  */
294
416
  public static function findFromNetwork($search, $store = null, $limit = 20, $network = null): ?\Illuminate\Database\Eloquent\Collection
295
417
  {
@@ -3,21 +3,24 @@
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
+ use Fleetbase\FleetOps\Support\Utils;
6
7
  use Fleetbase\Models\Category;
7
8
  use Fleetbase\Models\User;
8
- use Fleetbase\FleetOps\Support\Utils;
9
- use Fleetbase\Traits\HasUuid;
10
9
  use Fleetbase\Traits\HasApiModelBehavior;
11
10
  use Fleetbase\Traits\HasPublicid;
11
+ use Fleetbase\Traits\HasUuid;
12
12
  use Spatie\Sluggable\HasSlug;
13
13
  use Spatie\Sluggable\SlugOptions;
14
14
 
15
15
  class ProductAddon extends StorefrontModel
16
16
  {
17
- use HasUuid, HasPublicid, HasApiModelBehavior, HasSlug;
17
+ use HasUuid;
18
+ use HasPublicid;
19
+ use HasApiModelBehavior;
20
+ use HasSlug;
18
21
 
19
22
  /**
20
- * The type of public Id to generate
23
+ * The type of public Id to generate.
21
24
  *
22
25
  * @var string
23
26
  */
@@ -31,7 +34,7 @@ class ProductAddon extends StorefrontModel
31
34
  protected $table = 'product_addons';
32
35
 
33
36
  /**
34
- * These attributes that can be queried
37
+ * These attributes that can be queried.
35
38
  *
36
39
  * @var array
37
40
  */
@@ -52,7 +55,7 @@ class ProductAddon extends StorefrontModel
52
55
  'price',
53
56
  'sale_price',
54
57
  'is_on_sale',
55
- 'slug'
58
+ 'slug',
56
59
  ];
57
60
 
58
61
  /**
@@ -61,12 +64,12 @@ class ProductAddon extends StorefrontModel
61
64
  * @var array
62
65
  */
63
66
  protected $casts = [
64
- 'is_on_sale' => 'boolean',
65
- 'translations' => Json::class
67
+ 'is_on_sale' => 'boolean',
68
+ 'translations' => Json::class,
66
69
  ];
67
70
 
68
71
  /**
69
- * Dynamic attributes that are appended to object
72
+ * Dynamic attributes that are appended to object.
70
73
  *
71
74
  * @var array
72
75
  */
@@ -107,7 +110,7 @@ class ProductAddon extends StorefrontModel
107
110
  }
108
111
 
109
112
  /**
110
- * Set the price as only numbers
113
+ * Set the price as only numbers.
111
114
  *
112
115
  * @void
113
116
  */
@@ -117,7 +120,7 @@ class ProductAddon extends StorefrontModel
117
120
  }
118
121
 
119
122
  /**
120
- * Set the sale price as only numbers
123
+ * Set the sale price as only numbers.
121
124
  *
122
125
  * @void
123
126
  */
@@ -3,12 +3,13 @@
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
- use Fleetbase\Traits\HasUuid;
7
6
  use Fleetbase\Traits\HasApiModelBehavior;
7
+ use Fleetbase\Traits\HasUuid;
8
8
 
9
9
  class ProductAddonCategory extends StorefrontModel
10
10
  {
11
- use HasUuid, HasApiModelBehavior;
11
+ use HasUuid;
12
+ use HasApiModelBehavior;
12
13
 
13
14
  /**
14
15
  * The database table used by the model.
@@ -18,7 +19,7 @@ class ProductAddonCategory extends StorefrontModel
18
19
  protected $table = 'product_addon_categories';
19
20
 
20
21
  /**
21
- * These attributes that can be queried
22
+ * These attributes that can be queried.
22
23
  *
23
24
  * @var array
24
25
  */
@@ -32,8 +33,8 @@ class ProductAddonCategory extends StorefrontModel
32
33
  protected $fillable = [
33
34
  'product_uuid',
34
35
  'category_uuid',
35
- 'exluded_addons',
36
- 'max_selectable'
36
+ 'excluded_addons',
37
+ 'max_selectable',
37
38
  ];
38
39
 
39
40
  /**
@@ -42,18 +43,18 @@ class ProductAddonCategory extends StorefrontModel
42
43
  * @var array
43
44
  */
44
45
  protected $casts = [
45
- 'exluded_addons' => Json::class
46
+ 'excluded_addons' => Json::class,
46
47
  ];
47
48
 
48
49
  /**
49
- * Dynamic attributes that are appended to object
50
+ * Dynamic attributes that are appended to object.
50
51
  *
51
52
  * @var array
52
53
  */
53
54
  protected $appends = ['name'];
54
55
 
55
56
  /**
56
- * Dynamic attributes should be hidden
57
+ * Dynamic attributes should be hidden.
57
58
  *
58
59
  * @var array
59
60
  */
@@ -2,12 +2,13 @@
2
2
 
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
- use Fleetbase\Traits\HasUuid;
6
5
  use Fleetbase\Traits\HasApiModelBehavior;
6
+ use Fleetbase\Traits\HasUuid;
7
7
 
8
8
  class ProductHour extends StorefrontModel
9
9
  {
10
- use HasUuid, HasApiModelBehavior;
10
+ use HasUuid;
11
+ use HasApiModelBehavior;
11
12
 
12
13
  /**
13
14
  * The database table used by the model.
@@ -17,7 +18,7 @@ class ProductHour extends StorefrontModel
17
18
  protected $table = 'product_hours';
18
19
 
19
20
  /**
20
- * These attributes that can be queried
21
+ * These attributes that can be queried.
21
22
  *
22
23
  * @var array
23
24
  */
@@ -32,7 +33,7 @@ class ProductHour extends StorefrontModel
32
33
  'product_uuid',
33
34
  'day_of_week',
34
35
  'start',
35
- 'end'
36
+ 'end',
36
37
  ];
37
38
 
38
39
  /**
@@ -43,7 +44,7 @@ class ProductHour extends StorefrontModel
43
44
  protected $casts = [];
44
45
 
45
46
  /**
46
- * Dynamic attributes that are appended to object
47
+ * Dynamic attributes that are appended to object.
47
48
  *
48
49
  * @var array
49
50
  */
@@ -2,14 +2,16 @@
2
2
 
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
- use Fleetbase\Traits\HasUuid;
6
5
  use Fleetbase\Traits\HasApiModelBehavior;
6
+ use Fleetbase\Traits\HasUuid;
7
7
  use Spatie\Sluggable\HasSlug;
8
8
  use Spatie\Sluggable\SlugOptions;
9
9
 
10
10
  class ProductStoreLocation extends StorefrontModel
11
11
  {
12
- use HasUuid, HasApiModelBehavior, HasSlug;
12
+ use HasUuid;
13
+ use HasApiModelBehavior;
14
+ use HasSlug;
13
15
 
14
16
  /**
15
17
  * The database table used by the model.
@@ -19,7 +21,7 @@ class ProductStoreLocation extends StorefrontModel
19
21
  protected $table = 'product_store_locations';
20
22
 
21
23
  /**
22
- * These attributes that can be queried
24
+ * These attributes that can be queried.
23
25
  *
24
26
  * @var array
25
27
  */
@@ -32,7 +34,7 @@ class ProductStoreLocation extends StorefrontModel
32
34
  */
33
35
  protected $fillable = [
34
36
  'product_uuid',
35
- 'store_location_uuid'
37
+ 'store_location_uuid',
36
38
  ];
37
39
 
38
40
  /**
@@ -43,7 +45,7 @@ class ProductStoreLocation extends StorefrontModel
43
45
  protected $casts = [];
44
46
 
45
47
  /**
46
- * Dynamic attributes that are appended to object
48
+ * Dynamic attributes that are appended to object.
47
49
  *
48
50
  * @var array
49
51
  */
@@ -5,19 +5,23 @@ namespace Fleetbase\Storefront\Models;
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\Models\Category;
7
7
  use Fleetbase\Models\User;
8
- use Fleetbase\Traits\HasMetaAttributes;
9
- use Fleetbase\Traits\HasUuid;
10
8
  use Fleetbase\Traits\HasApiModelBehavior;
9
+ use Fleetbase\Traits\HasMetaAttributes;
11
10
  use Fleetbase\Traits\HasPublicid;
11
+ use Fleetbase\Traits\HasUuid;
12
12
  use Spatie\Sluggable\HasSlug;
13
13
  use Spatie\Sluggable\SlugOptions;
14
14
 
15
15
  class ProductVariant extends StorefrontModel
16
16
  {
17
- use HasUuid, HasPublicid, HasApiModelBehavior, HasMetaAttributes, HasSlug;
17
+ use HasUuid;
18
+ use HasPublicid;
19
+ use HasApiModelBehavior;
20
+ use HasMetaAttributes;
21
+ use HasSlug;
18
22
 
19
23
  /**
20
- * The type of public Id to generate
24
+ * The type of public Id to generate.
21
25
  *
22
26
  * @var string
23
27
  */
@@ -31,7 +35,7 @@ class ProductVariant extends StorefrontModel
31
35
  protected $table = 'product_variants';
32
36
 
33
37
  /**
34
- * These attributes that can be queried
38
+ * These attributes that can be queried.
35
39
  *
36
40
  * @var array
37
41
  */
@@ -52,7 +56,7 @@ class ProductVariant extends StorefrontModel
52
56
  'is_multiselect',
53
57
  'is_required',
54
58
  'min',
55
- 'max'
59
+ 'max',
56
60
  ];
57
61
 
58
62
  /**
@@ -62,20 +66,20 @@ class ProductVariant extends StorefrontModel
62
66
  */
63
67
  protected $casts = [
64
68
  'is_multiselect' => 'boolean',
65
- 'is_required' => 'boolean',
66
- 'meta' => Json::class,
67
- 'translations' => Json::class
69
+ 'is_required' => 'boolean',
70
+ 'meta' => Json::class,
71
+ 'translations' => Json::class,
68
72
  ];
69
73
 
70
74
  /**
71
- * Dynamic attributes that are appended to object
75
+ * Dynamic attributes that are appended to object.
72
76
  *
73
77
  * @var array
74
78
  */
75
79
  protected $appends = [];
76
80
 
77
81
  /**
78
- * Relationships to auto load with driver
82
+ * Relationships to auto load with driver.
79
83
  *
80
84
  * @var array
81
85
  */
@@ -4,17 +4,20 @@ namespace Fleetbase\Storefront\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
- use Fleetbase\Traits\HasMetaAttributes;
8
- use Fleetbase\Traits\HasUuid;
9
7
  use Fleetbase\Traits\HasApiModelBehavior;
8
+ use Fleetbase\Traits\HasMetaAttributes;
10
9
  use Fleetbase\Traits\HasPublicid;
10
+ use Fleetbase\Traits\HasUuid;
11
11
 
12
12
  class ProductVariantOption extends StorefrontModel
13
13
  {
14
- use HasUuid, HasPublicid, HasMetaAttributes, HasApiModelBehavior;
14
+ use HasUuid;
15
+ use HasPublicid;
16
+ use HasMetaAttributes;
17
+ use HasApiModelBehavior;
15
18
 
16
19
  /**
17
- * The type of public Id to generate
20
+ * The type of public Id to generate.
18
21
  *
19
22
  * @var string
20
23
  */
@@ -28,7 +31,7 @@ class ProductVariantOption extends StorefrontModel
28
31
  protected $table = 'product_variant_options';
29
32
 
30
33
  /**
31
- * These attributes that can be queried
34
+ * These attributes that can be queried.
32
35
  *
33
36
  * @var array
34
37
  */
@@ -46,7 +49,7 @@ class ProductVariantOption extends StorefrontModel
46
49
  'description',
47
50
  'translations',
48
51
  'meta',
49
- 'additional_cost'
52
+ 'additional_cost',
50
53
  ];
51
54
 
52
55
  /**
@@ -56,11 +59,11 @@ class ProductVariantOption extends StorefrontModel
56
59
  */
57
60
  protected $casts = [
58
61
  'translations' => Json::class,
59
- 'meta' => Json::class
62
+ 'meta' => Json::class,
60
63
  ];
61
64
 
62
65
  /**
63
- * Dynamic attributes that are appended to object
66
+ * Dynamic attributes that are appended to object.
64
67
  *
65
68
  * @var array
66
69
  */
@@ -75,7 +78,7 @@ class ProductVariantOption extends StorefrontModel
75
78
  }
76
79
 
77
80
  /**
78
- * Set the price as only numbers
81
+ * Set the price as only numbers.
79
82
  *
80
83
  * @void
81
84
  */
@@ -2,18 +2,20 @@
2
2
 
3
3
  namespace Fleetbase\Storefront\Models;
4
4
 
5
- use Fleetbase\Models\File;
6
5
  use Fleetbase\FleetOps\Models\Contact;
7
- use Fleetbase\Traits\HasUuid;
6
+ use Fleetbase\Models\File;
8
7
  use Fleetbase\Traits\HasApiModelBehavior;
9
8
  use Fleetbase\Traits\HasPublicid;
9
+ use Fleetbase\Traits\HasUuid;
10
10
 
11
11
  class Review extends StorefrontModel
12
12
  {
13
- use HasUuid, HasPublicid, HasApiModelBehavior;
13
+ use HasUuid;
14
+ use HasPublicid;
15
+ use HasApiModelBehavior;
14
16
 
15
17
  /**
16
- * The type of public Id to generate
18
+ * The type of public Id to generate.
17
19
  *
18
20
  * @var string
19
21
  */
@@ -27,7 +29,7 @@ class Review extends StorefrontModel
27
29
  protected $table = 'reviews';
28
30
 
29
31
  /**
30
- * These attributes that can be queried
32
+ * These attributes that can be queried.
31
33
  *
32
34
  * @var array
33
35
  */
@@ -56,14 +58,14 @@ class Review extends StorefrontModel
56
58
  protected $casts = [];
57
59
 
58
60
  /**
59
- * Dynamic attributes that are appended to object
61
+ * Dynamic attributes that are appended to object.
60
62
  *
61
63
  * @var array
62
64
  */
63
65
  protected $appends = [];
64
66
 
65
67
  /**
66
- * Attributes that is filterable on this model
68
+ * Attributes that is filterable on this model.
67
69
  *
68
70
  * @var array
69
71
  */