@fleetbase/fleetops-engine 0.4.3 → 0.4.5

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 (116) hide show
  1. package/addon/components/contact-form-panel.hbs +1 -0
  2. package/addon/components/driver-panel.hbs +1 -0
  3. package/addon/components/edit-order-route-panel.hbs +183 -0
  4. package/addon/components/edit-order-route-panel.js +265 -0
  5. package/addon/components/fleet-form-panel.hbs +1 -0
  6. package/addon/components/fleet-panel.hbs +1 -0
  7. package/addon/components/fleet-panel.js +3 -3
  8. package/addon/components/fuel-report-form-panel.hbs +1 -0
  9. package/addon/components/fuel-report-panel.hbs +1 -0
  10. package/addon/components/issue-form-panel.hbs +1 -0
  11. package/addon/components/issue-panel.hbs +1 -0
  12. package/addon/components/map-container/toolbar.hbs +2 -2
  13. package/addon/components/modals/order-route-form.hbs +1 -1
  14. package/addon/components/place-form-panel.hbs +1 -0
  15. package/addon/components/place-panel.hbs +1 -0
  16. package/addon/components/vehicle-form-panel.hbs +1 -0
  17. package/addon/components/vehicle-panel.hbs +1 -0
  18. package/addon/components/vendor-form-panel.hbs +1 -0
  19. package/addon/components/vendor-panel.hbs +1 -0
  20. package/addon/components/widget/fleet-ops-key-metrics.hbs +19 -0
  21. package/addon/components/widget/fleet-ops-key-metrics.js +85 -0
  22. package/addon/controllers/operations/orders/index/new.js +66 -22
  23. package/addon/controllers/operations/orders/index/view.js +131 -126
  24. package/addon/controllers/operations/orders/index.js +1 -1
  25. package/addon/engine.js +18 -12
  26. package/addon/routes/operations/orders/index/view.js +1 -1
  27. package/addon/services/context-panel.js +6 -0
  28. package/addon/styles/fleetops-engine.css +7 -2
  29. package/addon/templates/operations/orders/index/new.hbs +390 -58
  30. package/addon/templates/operations/orders/index/view.hbs +135 -105
  31. package/addon/templates/operations/service-rates/index/new.hbs +3 -1
  32. package/app/components/widget/{issues.js → fleet-ops-key-metrics.js} +1 -1
  33. package/composer.json +6 -6
  34. package/extension.json +1 -1
  35. package/package.json +5 -6
  36. package/server/src/Casts/MultiPolygon.php +3 -3
  37. package/server/src/Casts/Point.php +2 -2
  38. package/server/src/Casts/Polygon.php +3 -3
  39. package/server/src/Console/Commands/DispatchAdhocOrders.php +1 -1
  40. package/server/src/Events/DriverSimulatedLocationChanged.php +1 -1
  41. package/server/src/Flow/Activity.php +12 -0
  42. package/server/src/Flow/Config.php +7 -0
  43. package/server/src/Flow/Logic.php +7 -0
  44. package/server/src/Http/Controllers/Api/v1/DriverController.php +61 -21
  45. package/server/src/Http/Controllers/Api/v1/OrderController.php +5 -3
  46. package/server/src/Http/Controllers/Api/v1/PlaceController.php +1 -1
  47. package/server/src/Http/Controllers/Api/v1/ServiceAreaController.php +1 -1
  48. package/server/src/Http/Controllers/Api/v1/TrackingStatusController.php +1 -1
  49. package/server/src/Http/Controllers/Api/v1/ZoneController.php +1 -1
  50. package/server/src/Http/Controllers/Internal/v1/DriverController.php +17 -4
  51. package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +2 -2
  52. package/server/src/Http/Controllers/Internal/v1/MetricsController.php +6 -50
  53. package/server/src/Http/Controllers/Internal/v1/OrderController.php +13 -2
  54. package/server/src/Http/Controllers/Internal/v1/PlaceController.php +1 -1
  55. package/server/src/Http/Filter/PlaceFilter.php +1 -1
  56. package/server/src/Http/Resources/v1/Driver.php +1 -1
  57. package/server/src/Http/Resources/v1/FuelReport.php +1 -1
  58. package/server/src/Http/Resources/v1/Issue.php +1 -1
  59. package/server/src/Http/Resources/v1/Order.php +3 -0
  60. package/server/src/Http/Resources/v1/Payload.php +1 -0
  61. package/server/src/Http/Resources/v1/Place.php +1 -1
  62. package/server/src/Http/Resources/v1/PurchaseRate.php +2 -1
  63. package/server/src/Http/Resources/v1/ServiceQuote.php +1 -0
  64. package/server/src/Http/Resources/v1/ServiceQuoteItem.php +29 -0
  65. package/server/src/Http/Resources/v1/TrackingStatus.php +1 -1
  66. package/server/src/Http/Resources/v1/Vehicle.php +1 -1
  67. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +1 -1
  68. package/server/src/Http/Resources/v1/Waypoint.php +2 -4
  69. package/server/src/Integrations/Lalamove/LalamoveDeliveryStop.php +2 -2
  70. package/server/src/Jobs/SimulateWaypointReached.php +2 -2
  71. package/server/src/Models/Contact.php +6 -18
  72. package/server/src/Models/Driver.php +8 -20
  73. package/server/src/Models/Fleet.php +6 -25
  74. package/server/src/Models/FuelReport.php +1 -1
  75. package/server/src/Models/Issue.php +1 -1
  76. package/server/src/Models/Order.php +31 -19
  77. package/server/src/Models/Payload.php +7 -7
  78. package/server/src/Models/Place.php +16 -16
  79. package/server/src/Models/Position.php +1 -1
  80. package/server/src/Models/ServiceArea.php +14 -14
  81. package/server/src/Models/TrackingNumber.php +1 -1
  82. package/server/src/Models/TrackingStatus.php +1 -1
  83. package/server/src/Models/Vehicle.php +7 -19
  84. package/server/src/Models/VehicleDeviceEvent.php +1 -1
  85. package/server/src/Models/Vendor.php +8 -25
  86. package/server/src/Models/Waypoint.php +6 -6
  87. package/server/src/Models/Zone.php +8 -8
  88. package/server/src/Observers/DriverObserver.php +7 -2
  89. package/server/src/Observers/TrackingNumberObserver.php +1 -1
  90. package/server/src/Rules/ResolvablePoint.php +1 -1
  91. package/server/src/Support/Encoding/Polyline.php +1 -1
  92. package/server/src/Support/OSRM.php +1 -1
  93. package/server/src/Support/Utils.php +60 -60
  94. package/server/src/Traits/HasTrackingNumber.php +3 -3
  95. package/server/src/routes.php +2 -4
  96. package/translations/en-us.yaml +10 -2
  97. package/addon/components/widget/fleet-ops-quickstart.hbs +0 -40
  98. package/addon/components/widget/fleet-ops-quickstart.js +0 -59
  99. package/addon/components/widget/issues.hbs +0 -1
  100. package/addon/components/widget/key-metrics.hbs +0 -121
  101. package/addon/components/widget/key-metrics.js +0 -46
  102. package/addon/components/widget/live-order-map.hbs +0 -59
  103. package/addon/components/widget/live-order-map.js +0 -11
  104. package/addon/components/widget/recent-orders.hbs +0 -35
  105. package/addon/components/widget/recent-orders.js +0 -24
  106. package/addon/components/widget/transaction-earnings.hbs +0 -1
  107. package/addon/components/widget/transactions.hbs +0 -36
  108. package/addon/components/widget/transactions.js +0 -29
  109. package/addon/components/widget/weekly-orders.hbs +0 -1
  110. package/addon/components/widget/weekly-orders.js +0 -3
  111. package/app/components/widget/key-metrics.js +0 -1
  112. package/app/components/widget/live-order-map.js +0 -1
  113. package/app/components/widget/recent-orders.js +0 -1
  114. package/app/components/widget/transaction-earnings.js +0 -1
  115. package/app/components/widget/transactions.js +0 -1
  116. package/app/components/widget/weekly-orders.js +0 -1
@@ -13,6 +13,7 @@ use Fleetbase\Traits\Searchable;
13
13
  use Fleetbase\Traits\SendsWebhooks;
14
14
  use Fleetbase\Traits\TracksApiCredential;
15
15
  use Illuminate\Notifications\Notifiable;
16
+ use Spatie\Activitylog\LogOptions;
16
17
  use Spatie\Activitylog\Traits\CausesActivity;
17
18
  use Spatie\Activitylog\Traits\LogsActivity;
18
19
  use Spatie\Sluggable\HasSlug;
@@ -92,25 +93,12 @@ class Contact extends Model
92
93
  protected $filterParams = ['place_uuid', 'customer_type', 'facilitator_type', 'place'];
93
94
 
94
95
  /**
95
- * Properties which activity needs to be logged.
96
- *
97
- * @var array
96
+ * Get the activity log options for the model.
98
97
  */
99
- protected static $logAttributes = '*';
100
-
101
- /**
102
- * Do not log empty changed.
103
- *
104
- * @var bool
105
- */
106
- protected static $submitEmptyLogs = false;
107
-
108
- /**
109
- * The name of the subject to log.
110
- *
111
- * @var string
112
- */
113
- protected static $logName = 'contact';
98
+ public function getActivitylogOptions(): LogOptions
99
+ {
100
+ return LogOptions::defaults()->logOnly(['*'])->logOnlyDirty();
101
+ }
114
102
 
115
103
  /**
116
104
  * Get the options for generating the slug.
@@ -7,6 +7,7 @@ use Fleetbase\FleetOps\Casts\Point;
7
7
  use Fleetbase\FleetOps\Scopes\DriverScope;
8
8
  use Fleetbase\FleetOps\Support\Utils;
9
9
  use Fleetbase\FleetOps\Support\Utils as FleetOpsUtils;
10
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
10
11
  use Fleetbase\Models\Model;
11
12
  use Fleetbase\Traits\HasApiModelBehavior;
12
13
  use Fleetbase\Traits\HasInternalId;
@@ -14,11 +15,11 @@ use Fleetbase\Traits\HasPublicId;
14
15
  use Fleetbase\Traits\HasUuid;
15
16
  use Fleetbase\Traits\SendsWebhooks;
16
17
  use Fleetbase\Traits\TracksApiCredential;
17
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
18
18
  use Illuminate\Broadcasting\Channel;
19
19
  use Illuminate\Notifications\Notifiable;
20
20
  use Illuminate\Support\Facades\DB;
21
21
  use Illuminate\Support\Str;
22
+ use Spatie\Activitylog\LogOptions;
22
23
  use Spatie\Activitylog\Traits\CausesActivity;
23
24
  use Spatie\Activitylog\Traits\LogsActivity;
24
25
  use Spatie\Sluggable\HasSlug;
@@ -157,25 +158,12 @@ class Driver extends Model
157
158
  protected $filterParams = ['vendor', 'facilitator', 'customer', 'fleet', 'photo_uuid', 'avatar_uuid'];
158
159
 
159
160
  /**
160
- * Properties which activity needs to be logged.
161
- *
162
- * @var array
161
+ * Get the activity log options for the model.
163
162
  */
164
- protected static $logAttributes = '*';
165
-
166
- /**
167
- * Do not log empty changed.
168
- *
169
- * @var bool
170
- */
171
- protected static $submitEmptyLogs = false;
172
-
173
- /**
174
- * The name of the subject to log.
175
- *
176
- * @var string
177
- */
178
- protected static $logName = 'driver';
163
+ public function getActivitylogOptions(): LogOptions
164
+ {
165
+ return LogOptions::defaults()->logOnly(['*'])->logOnlyDirty();
166
+ }
179
167
 
180
168
  /**
181
169
  * Get the options for generating the slug.
@@ -203,7 +191,7 @@ class Driver extends Model
203
191
  */
204
192
  public function user()
205
193
  {
206
- return $this->belongsTo(\Fleetbase\Models\User::class)->select(['uuid', 'avatar_uuid', 'name', 'phone', 'email'])->without(['driver'])->withTrashed();
194
+ return $this->belongsTo(\Fleetbase\Models\User::class)->select(['uuid', 'company_uuid', 'avatar_uuid', 'name', 'phone', 'email'])->without(['driver'])->withTrashed();
207
195
  }
208
196
 
209
197
  /**
@@ -10,6 +10,7 @@ use Fleetbase\Traits\Searchable;
10
10
  use Fleetbase\Traits\SendsWebhooks;
11
11
  use Fleetbase\Traits\TracksApiCredential;
12
12
  use Illuminate\Notifications\Notifiable;
13
+ use Spatie\Activitylog\LogOptions;
13
14
  use Spatie\Activitylog\Traits\LogsActivity;
14
15
  use Spatie\Sluggable\HasSlug;
15
16
  use Spatie\Sluggable\SlugOptions;
@@ -48,32 +49,12 @@ class Fleet extends Model
48
49
  protected $searchableColumns = ['name'];
49
50
 
50
51
  /**
51
- * Properties which activity needs to be logged.
52
- *
53
- * @var array
52
+ * Get the activity log options for the model.
54
53
  */
55
- protected static $logAttributes = ['name', 'task', 'service_area_uuid', 'zone_uuid'];
56
-
57
- /**
58
- * Do not log empty changed.
59
- *
60
- * @var bool
61
- */
62
- protected static $submitEmptyLogs = false;
63
-
64
- /**
65
- * We only want to log changed attributes.
66
- *
67
- * @var bool
68
- */
69
- protected static $logOnlyDirty = true;
70
-
71
- /**
72
- * The name of the subject to log.
73
- *
74
- * @var string
75
- */
76
- protected static $logName = 'fleet';
54
+ public function getActivitylogOptions(): LogOptions
55
+ {
56
+ return LogOptions::defaults()->logOnly(['name', 'task', 'service_area_uuid', 'zone_uuid'])->logOnlyDirty();
57
+ }
77
58
 
78
59
  /**
79
60
  * The flug options for this model.
@@ -5,13 +5,13 @@ namespace Fleetbase\FleetOps\Models;
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
7
  use Fleetbase\FleetOps\Support\Utils;
8
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
9
  use Fleetbase\Models\Model;
9
10
  use Fleetbase\Traits\HasApiModelBehavior;
10
11
  use Fleetbase\Traits\HasPublicId;
11
12
  use Fleetbase\Traits\HasUuid;
12
13
  use Fleetbase\Traits\Searchable;
13
14
  use Fleetbase\Traits\TracksApiCredential;
14
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
15
15
 
16
16
  class FuelReport extends Model
17
17
  {
@@ -4,12 +4,12 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasPublicId;
10
11
  use Fleetbase\Traits\HasUuid;
11
12
  use Fleetbase\Traits\TracksApiCredential;
12
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
13
13
  use Illuminate\Support\Str;
14
14
 
15
15
  class Issue extends Model
@@ -12,6 +12,7 @@ use Fleetbase\FleetOps\Events\OrderDriverAssigned;
12
12
  use Fleetbase\FleetOps\Support\Flow;
13
13
  use Fleetbase\FleetOps\Support\Utils;
14
14
  use Fleetbase\FleetOps\Traits\HasTrackingNumber;
15
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
15
16
  use Fleetbase\Models\Model;
16
17
  use Fleetbase\Models\Transaction;
17
18
  use Fleetbase\Traits\HasApiModelBehavior;
@@ -23,9 +24,9 @@ use Fleetbase\Traits\HasUuid;
23
24
  use Fleetbase\Traits\Searchable;
24
25
  use Fleetbase\Traits\SendsWebhooks;
25
26
  use Fleetbase\Traits\TracksApiCredential;
26
- use Grimzy\LaravelMysqlSpatial\Types\Point;
27
27
  use Illuminate\Support\Carbon;
28
28
  use Illuminate\Support\Str;
29
+ use Spatie\Activitylog\LogOptions;
29
30
  use Spatie\Activitylog\Traits\LogsActivity;
30
31
 
31
32
  class Order extends Model
@@ -201,25 +202,12 @@ class Order extends Model
201
202
  ];
202
203
 
203
204
  /**
204
- * Properties which activity needs to be logged.
205
- *
206
- * @var array
207
- */
208
- protected static $logAttributes = '*';
209
-
210
- /**
211
- * Do not log empty changed.
212
- *
213
- * @var bool
214
- */
215
- protected static $submitEmptyLogs = false;
216
-
217
- /**
218
- * The name of the subject to log.
219
- *
220
- * @var string
205
+ * Get the activity log options for the model.
221
206
  */
222
- protected static $logName = 'order';
207
+ public function getActivitylogOptions(): LogOptions
208
+ {
209
+ return LogOptions::defaults()->logOnly(['*'])->logOnlyDirty();
210
+ }
223
211
 
224
212
  /**
225
213
  * @return \Barryvdh\DomPDF\PDF
@@ -323,6 +311,30 @@ class Order extends Model
323
311
  return $this->belongsTo(Driver::class)->without(['devices', 'vendor']);
324
312
  }
325
313
 
314
+ /**
315
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
316
+ */
317
+ public function comments()
318
+ {
319
+ return $this->hasMany(\Fleetbase\Models\Comment::class, 'subject_uuid')->whereNull('parent_comment_uuid')->latest();
320
+ }
321
+
322
+ /**
323
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
324
+ */
325
+ public function files()
326
+ {
327
+ return $this->hasMany(\Fleetbase\Models\File::class, 'subject_uuid')->latest();
328
+ }
329
+
330
+ /**
331
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
332
+ */
333
+ public function customFields()
334
+ {
335
+ return $this->hasMany(\Fleetbase\Models\CustomField::class, 'subject_uuid')->orderBy('order');
336
+ }
337
+
326
338
  /**
327
339
  * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
328
340
  */
@@ -5,13 +5,13 @@ namespace Fleetbase\FleetOps\Models;
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
7
  use Fleetbase\Http\Resources\Internal\v1\Payload as PayloadResource;
8
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
8
9
  use Fleetbase\Models\Model;
9
10
  use Fleetbase\Traits\HasApiModelBehavior;
10
11
  use Fleetbase\Traits\HasMetaAttributes;
11
12
  use Fleetbase\Traits\HasPublicId;
12
13
  use Fleetbase\Traits\HasUuid;
13
14
  use Fleetbase\Traits\TracksApiCredential;
14
- use Grimzy\LaravelMysqlSpatial\Types\Point;
15
15
  use Illuminate\Support\Facades\DB;
16
16
  use Illuminate\Support\Str;
17
17
 
@@ -562,7 +562,7 @@ class Payload extends Model
562
562
  /**
563
563
  * Get the pickup location for the payload.
564
564
  *
565
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point
565
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point
566
566
  */
567
567
  public function getPickupLocation()
568
568
  {
@@ -653,8 +653,8 @@ class Payload extends Model
653
653
  /**
654
654
  * Set the first waypoint and update activity.
655
655
  *
656
- * @param array $activity
657
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $location
656
+ * @param array $activity
657
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $location
658
658
  *
659
659
  * @return void
660
660
  */
@@ -682,9 +682,9 @@ class Payload extends Model
682
682
  /**
683
683
  * Update the current waypoint activity and it's entities.
684
684
  *
685
- * @param array $activity
686
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $location
687
- * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
685
+ * @param array $activity
686
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $location
687
+ * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
688
688
  *
689
689
  * @return $this
690
690
  */
@@ -6,6 +6,7 @@ use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
7
  use Fleetbase\FleetOps\Support\Geocoding;
8
8
  use Fleetbase\FleetOps\Support\Utils;
9
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
9
10
  use Fleetbase\Models\Model;
10
11
  use Fleetbase\Traits\HasApiModelBehavior;
11
12
  use Fleetbase\Traits\HasMetaAttributes;
@@ -14,7 +15,6 @@ use Fleetbase\Traits\HasUuid;
14
15
  use Fleetbase\Traits\Searchable;
15
16
  use Fleetbase\Traits\SendsWebhooks;
16
17
  use Fleetbase\Traits\TracksApiCredential;
17
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
18
18
  use Illuminate\Support\Carbon;
19
19
  use Illuminate\Support\Facades\DB;
20
20
  use Illuminate\Support\Str;
@@ -171,7 +171,7 @@ class Place extends Model
171
171
  /**
172
172
  * Returns a Point instance from the location of the model.
173
173
  */
174
- public function getLocationAsPoint(): \Grimzy\LaravelMysqlSpatial\Types\Point
174
+ public function getLocationAsPoint(): \Fleetbase\LaravelMysqlSpatial\Types\Point
175
175
  {
176
176
  return Utils::getPointFromCoordinates($this->location);
177
177
  }
@@ -218,7 +218,7 @@ class Place extends Model
218
218
  }
219
219
 
220
220
  if ($coordinates = $address->getCoordinates()) {
221
- $this->setAttribute('location', new \Grimzy\LaravelMysqlSpatial\Types\Point($coordinates->getLatitude(), $coordinates->getLongitude()));
221
+ $this->setAttribute('location', new \Fleetbase\LaravelMysqlSpatial\Types\Point($coordinates->getLatitude(), $coordinates->getLongitude()));
222
222
  }
223
223
 
224
224
  return $this;
@@ -245,7 +245,7 @@ class Place extends Model
245
245
  $attributes['city'] = $address->getLocality();
246
246
  $attributes['building'] = $address->getStreetNumber();
247
247
  $attributes['country'] = $address->getCountry() instanceof \Geocoder\Model\Country ? $address->getCountry()->getCode() : null;
248
- $attributes['location'] = new \Grimzy\LaravelMysqlSpatial\Types\Point($coordinates->getLatitude(), $coordinates->getLongitude());
248
+ $attributes['location'] = new \Fleetbase\LaravelMysqlSpatial\Types\Point($coordinates->getLatitude(), $coordinates->getLongitude());
249
249
 
250
250
  return $attributes;
251
251
  }
@@ -303,7 +303,7 @@ class Place extends Model
303
303
  *
304
304
  * @return \Fleetbase\Models\Place|null
305
305
  */
306
- public static function createFromReverseGeocodingLookup(\Grimzy\LaravelMysqlSpatial\Types\Point $point, $saveInstance = false): ?Place
306
+ public static function createFromReverseGeocodingLookup(\Fleetbase\LaravelMysqlSpatial\Types\Point $point, $saveInstance = false): ?Place
307
307
  {
308
308
  $results = Geocoding::reverseFromCoordinates($point->getLat(), $point->getLng());
309
309
  $place = $results->first();
@@ -322,8 +322,8 @@ class Place extends Model
322
322
  /**
323
323
  * Creates a new Place instance from given coordinates.
324
324
  *
325
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point|array $coordinates
326
- * @param bool $saveInstance
325
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point|array $coordinates
326
+ * @param bool $saveInstance
327
327
  *
328
328
  * @return \Fleetbase\Models\Place|null
329
329
  */
@@ -332,15 +332,15 @@ class Place extends Model
332
332
  $instance = new Place();
333
333
  $point = Utils::getPointFromMixed($coordinates);
334
334
 
335
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
335
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
336
336
  $latitude = $coordinates->getLat();
337
337
  $longitude = $coordinates->getLng();
338
- } elseif ($point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
338
+ } elseif ($point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
339
339
  $latitude = $point->getLat();
340
340
  $longitude = $point->getLng();
341
341
  }
342
342
 
343
- $instance->setAttribute('location', new \Grimzy\LaravelMysqlSpatial\Types\Point($latitude, $longitude));
343
+ $instance->setAttribute('location', new \Fleetbase\LaravelMysqlSpatial\Types\Point($latitude, $longitude));
344
344
  $instance->fill($attributes);
345
345
 
346
346
  $results = \Geocoder\Laravel\Facades\Geocoder::reverse($latitude, $longitude)->get();
@@ -361,8 +361,8 @@ class Place extends Model
361
361
  /**
362
362
  * Inserts a new place into the database using latitude and longitude coordinates.
363
363
  *
364
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point|array $coordinates
365
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point|string|array $coordinates the coordinates to use for the new place
364
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point|array $coordinates
365
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point|string|array $coordinates the coordinates to use for the new place
366
366
  *
367
367
  * @return mixed returns the UUID of the new place on success or false on failure
368
368
  */
@@ -371,11 +371,11 @@ class Place extends Model
371
371
  $attributes = array_merge([], $attributes);
372
372
  $point = Utils::getPointFromMixed($coordinates);
373
373
 
374
- if ($coordinates instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
374
+ if ($coordinates instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
375
375
  $attributes['location'] = $coordinates;
376
376
  $latitude = $coordinates->getLat();
377
377
  $longitude = $coordinates->getLng();
378
- } elseif ($point instanceof \Grimzy\LaravelMysqlSpatial\Types\Point) {
378
+ } elseif ($point instanceof \Fleetbase\LaravelMysqlSpatial\Types\Point) {
379
379
  $attributes['location'] = $point;
380
380
  $latitude = $point->getLat();
381
381
  $longitude = $point->getLng();
@@ -451,8 +451,8 @@ class Place extends Model
451
451
  $uuid = data_get($place, 'uuid');
452
452
 
453
453
  // If $place has a valid uuid and a matching Place object exists, return the uuid
454
- if (Str::isUuid($uuid) && $place = Place::where('uuid', $uuid)->first()) {
455
- return $place;
454
+ if (Str::isUuid($uuid) && $existingPlace = Place::where('uuid', $uuid)->first()) {
455
+ return $existingPlace;
456
456
  }
457
457
 
458
458
  // Otherwise, create a new Place object with the given attributes
@@ -2,11 +2,11 @@
2
2
 
3
3
  namespace Fleetbase\FleetOps\Models;
4
4
 
5
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
5
6
  use Fleetbase\Models\Model;
6
7
  use Fleetbase\Traits\HasApiModelBehavior;
7
8
  use Fleetbase\Traits\HasUuid;
8
9
  use Fleetbase\Traits\TracksApiCredential;
9
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
10
10
 
11
11
  class Position extends Model
12
12
  {
@@ -4,22 +4,22 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\MultiPolygon as MultiPolygonCast;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
+ use Fleetbase\LaravelMysqlSpatial\Types\LineString;
9
+ use Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon;
10
+ use Fleetbase\LaravelMysqlSpatial\Types\Point;
11
+ use Fleetbase\LaravelMysqlSpatial\Types\Polygon;
7
12
  use Fleetbase\Models\Model;
8
13
  use Fleetbase\Traits\HasApiModelBehavior;
9
14
  use Fleetbase\Traits\HasPublicId;
10
15
  use Fleetbase\Traits\HasUuid;
11
16
  use Fleetbase\Traits\SendsWebhooks;
12
17
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
- use Grimzy\LaravelMysqlSpatial\Types\LineString;
15
- use Grimzy\LaravelMysqlSpatial\Types\MultiPolygon;
16
- use Grimzy\LaravelMysqlSpatial\Types\Point;
17
- use Grimzy\LaravelMysqlSpatial\Types\Polygon;
18
18
  use Illuminate\Support\Arr;
19
19
 
20
20
  /**
21
- * @var \Grimzy\LaravelMysqlSpatial\Types\Point $location
22
- * @var \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon $border
21
+ * @var \Fleetbase\LaravelMysqlSpatial\Types\Point $location
22
+ * @var \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon $border
23
23
  */
24
24
  class ServiceArea extends Model
25
25
  {
@@ -130,10 +130,10 @@ class ServiceArea extends Model
130
130
  /**
131
131
  * Creates a polygon from a given point and radius.
132
132
  *
133
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
134
- * @param int $meters The radius in meters for the polygon. Default is 500 meters.
133
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
134
+ * @param int $meters The radius in meters for the polygon. Default is 500 meters.
135
135
  *
136
- * @return \Grimzy\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
136
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
137
137
  */
138
138
  public static function createPolygonFromPoint(Point $point, int $meters = 500): Polygon
139
139
  {
@@ -150,10 +150,10 @@ class ServiceArea extends Model
150
150
  /**
151
151
  * Creates a multi-polygon from a given point and radius.
152
152
  *
153
- * @param \Grimzy\LaravelMysqlSpatial\Types\Point $point the central point from which to create the multi-polygon
154
- * @param int $meters The radius in meters for the multi-polygon. Default is 500 meters.
153
+ * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the multi-polygon
154
+ * @param int $meters The radius in meters for the multi-polygon. Default is 500 meters.
155
155
  *
156
- * @return \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon returns a MultiPolygon object
156
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon returns a MultiPolygon object
157
157
  */
158
158
  public static function createMultiPolygonFromPoint(Point $point, int $meters = 500): MultiPolygon
159
159
  {
@@ -180,7 +180,7 @@ class ServiceArea extends Model
180
180
  /**
181
181
  * Retrieves the location attribute as a point.
182
182
  *
183
- * @return \Grimzy\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
183
+ * @return \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
184
184
  */
185
185
  public function getLocationAttribute(): Point
186
186
  {
@@ -4,13 +4,13 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\FleetOps\Casts\Point;
6
6
  use Fleetbase\FleetOps\Support\Utils;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasPublicId;
10
11
  use Fleetbase\Traits\HasUuid;
11
12
  use Fleetbase\Traits\SendsWebhooks;
12
13
  use Fleetbase\Traits\TracksApiCredential;
13
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
14
14
  use Illuminate\Support\Carbon;
15
15
  use Illuminate\Support\Facades\DB;
16
16
  use Illuminate\Support\Str;
@@ -4,6 +4,7 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasMetaAttributes;
@@ -11,7 +12,6 @@ use Fleetbase\Traits\HasPublicId;
11
12
  use Fleetbase\Traits\HasUuid;
12
13
  use Fleetbase\Traits\SendsWebhooks;
13
14
  use Fleetbase\Traits\TracksApiCredential;
14
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
15
15
  use Illuminate\Support\Carbon;
16
16
  use Illuminate\Support\Str;
17
17
 
@@ -5,6 +5,7 @@ namespace Fleetbase\FleetOps\Models;
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
7
  use Fleetbase\FleetOps\Support\Utils;
8
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
8
9
  use Fleetbase\Models\Model;
9
10
  use Fleetbase\Traits\HasApiModelBehavior;
10
11
  use Fleetbase\Traits\HasMetaAttributes;
@@ -12,8 +13,8 @@ use Fleetbase\Traits\HasPublicId;
12
13
  use Fleetbase\Traits\HasUuid;
13
14
  use Fleetbase\Traits\Searchable;
14
15
  use Fleetbase\Traits\TracksApiCredential;
15
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
16
16
  use Illuminate\Support\Str;
17
+ use Spatie\Activitylog\LogOptions;
17
18
  use Spatie\Activitylog\Traits\LogsActivity;
18
19
  use Spatie\Sluggable\HasSlug;
19
20
  use Spatie\Sluggable\SlugOptions;
@@ -66,25 +67,12 @@ class Vehicle extends Model
66
67
  protected $with = [];
67
68
 
68
69
  /**
69
- * Properties which activity needs to be logged.
70
- *
71
- * @var array
70
+ * Get the activity log options for the model.
72
71
  */
73
- protected static $logAttributes = '*';
74
-
75
- /**
76
- * Do not log empty changed.
77
- *
78
- * @var bool
79
- */
80
- protected static $submitEmptyLogs = false;
81
-
82
- /**
83
- * The name of the subject to log.
84
- *
85
- * @var string
86
- */
87
- protected static $logName = 'vehicle';
72
+ public function getActivitylogOptions(): LogOptions
73
+ {
74
+ return LogOptions::defaults()->logOnly(['*'])->logOnlyDirty();
75
+ }
88
76
 
89
77
  /**
90
78
  * Get the options for generating the slug.
@@ -4,12 +4,12 @@ namespace Fleetbase\FleetOps\Models;
4
4
 
5
5
  use Fleetbase\Casts\Json;
6
6
  use Fleetbase\FleetOps\Casts\Point;
7
+ use Fleetbase\LaravelMysqlSpatial\Eloquent\SpatialTrait;
7
8
  use Fleetbase\Models\Model;
8
9
  use Fleetbase\Traits\HasApiModelBehavior;
9
10
  use Fleetbase\Traits\HasUuid;
10
11
  use Fleetbase\Traits\Searchable;
11
12
  use Fleetbase\Traits\TracksApiCredential;
12
- use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
13
13
 
14
14
  class VehicleDeviceEvent extends Model
15
15
  {
@@ -11,6 +11,7 @@ use Fleetbase\Traits\HasUuid;
11
11
  use Fleetbase\Traits\Searchable;
12
12
  use Fleetbase\Traits\TracksApiCredential;
13
13
  use Illuminate\Notifications\Notifiable;
14
+ use Spatie\Activitylog\LogOptions;
14
15
  use Spatie\Activitylog\Traits\LogsActivity;
15
16
  use Spatie\Sluggable\HasSlug;
16
17
  use Spatie\Sluggable\SlugOptions;
@@ -106,32 +107,14 @@ class Vendor extends Model
106
107
  protected $with = ['place'];
107
108
 
108
109
  /**
109
- * Properties which activity needs to be logged.
110
- *
111
- * @var array
110
+ * Get the activity log options for the model.
112
111
  */
113
- protected static $logAttributes = ['name', 'email', 'website_url', 'phone', 'country', 'status', 'type', 'logo_uuid', 'company_uuid'];
114
-
115
- /**
116
- * Do not log empty changed.
117
- *
118
- * @var bool
119
- */
120
- protected static $submitEmptyLogs = false;
121
-
122
- /**
123
- * We only want to log changed attributes.
124
- *
125
- * @var bool
126
- */
127
- protected static $logOnlyDirty = true;
128
-
129
- /**
130
- * The name of the subject to log.
131
- *
132
- * @var string
133
- */
134
- protected static $logName = 'vendor';
112
+ public function getActivitylogOptions(): LogOptions
113
+ {
114
+ return LogOptions::defaults()
115
+ ->logOnly(['name', 'email', 'website_url', 'phone', 'country', 'status', 'type', 'logo_uuid', 'company_uuid'])
116
+ ->logOnlyDirty();
117
+ }
135
118
 
136
119
  /**
137
120
  * Get the options for generating the slug.