@fleetbase/fleetops-engine 0.4.8 → 0.4.10

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 (47) hide show
  1. package/composer.json +2 -2
  2. package/extension.json +1 -1
  3. package/package.json +1 -1
  4. package/server/src/Casts/Point.php +0 -2
  5. package/server/src/Exceptions/IntegratedVendorException.php +2 -2
  6. package/server/src/Flow/Activity.php +4 -3
  7. package/server/src/Flow/Config.php +4 -4
  8. package/server/src/Flow/Logic.php +4 -4
  9. package/server/src/Http/Controllers/Api/v1/DriverController.php +28 -20
  10. package/server/src/Http/Controllers/Api/v1/OrderController.php +5 -5
  11. package/server/src/Http/Controllers/Api/v1/TrackingNumberController.php +1 -1
  12. package/server/src/Http/Controllers/Internal/v1/DriverController.php +9 -11
  13. package/server/src/Http/Controllers/Internal/v1/FleetOpsLookupController.php +1 -1
  14. package/server/src/Http/Controllers/Internal/v1/GeocoderController.php +2 -2
  15. package/server/src/Http/Controllers/Internal/v1/MetricsController.php +0 -1
  16. package/server/src/Http/Controllers/Internal/v1/OrderController.php +4 -4
  17. package/server/src/Http/Resources/v1/Order.php +1 -1
  18. package/server/src/Http/Resources/v1/ServiceQuoteItem.php +6 -6
  19. package/server/src/Imports/OrdersImport.php +1 -1
  20. package/server/src/Integrations/Lalamove/Lalamove.php +5 -5
  21. package/server/src/Jobs/SimulateDrivingRoute.php +2 -2
  22. package/server/src/Jobs/SimulateWaypointReached.php +2 -2
  23. package/server/src/Listeners/HandleOrderDispatchFailed.php +1 -1
  24. package/server/src/Listeners/HandleOrderDriverAssigned.php +2 -2
  25. package/server/src/Models/Driver.php +2 -2
  26. package/server/src/Models/Entity.php +3 -3
  27. package/server/src/Models/Order.php +4 -4
  28. package/server/src/Models/Payload.php +8 -8
  29. package/server/src/Models/Place.php +1 -1
  30. package/server/src/Models/ServiceArea.php +9 -9
  31. package/server/src/Models/ServiceRate.php +2 -2
  32. package/server/src/Models/TrackingNumber.php +2 -2
  33. package/server/src/Models/TrackingStatus.php +1 -1
  34. package/server/src/Models/Vehicle.php +3 -3
  35. package/server/src/Models/Waypoint.php +1 -1
  36. package/server/src/Models/Zone.php +4 -4
  37. package/server/src/Notifications/OrderAssigned.php +22 -27
  38. package/server/src/Notifications/OrderCanceled.php +22 -23
  39. package/server/src/Notifications/OrderDispatchFailed.php +1 -1
  40. package/server/src/Notifications/OrderDispatched.php +22 -23
  41. package/server/src/Notifications/OrderPing.php +21 -22
  42. package/server/src/Notifications/OrderSplit.php +1 -1
  43. package/server/src/Support/Flow.php +6 -6
  44. package/server/src/Support/Geocoding.php +1 -1
  45. package/server/src/Support/IntegratedVendors.php +1 -1
  46. package/server/src/Support/Metrics.php +15 -15
  47. package/server/src/routes.php +3 -3
@@ -562,7 +562,7 @@ class Payload extends Model
562
562
  /**
563
563
  * Get the pickup location for the payload.
564
564
  *
565
- * @return \Fleetbase\LaravelMysqlSpatial\Types\Point
565
+ * @return 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 \Fleetbase\LaravelMysqlSpatial\Types\Point $location
656
+ * @param array $activity
657
+ * @param 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 \Fleetbase\LaravelMysqlSpatial\Types\Point $location
687
- * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
685
+ * @param array $activity
686
+ * @param Point $location
687
+ * @param \Fleetbase\Models\Proof|string|null $proof resolvable proof of delivery/activity
688
688
  *
689
689
  * @return $this
690
690
  */
@@ -743,14 +743,14 @@ class Payload extends Model
743
743
  $order = $this->order;
744
744
 
745
745
  // set google matrix based distance and time
746
- if ($order instanceof \Fleetbase\FleetOps\Models\Order) {
746
+ if ($order instanceof Order) {
747
747
  return $order->setDistanceAndTime();
748
748
  }
749
749
 
750
750
  return null;
751
751
  }
752
752
 
753
- public function findDestinationFromKey(string $destinationKey = null): ?Place
753
+ public function findDestinationFromKey(?string $destinationKey = null): ?Place
754
754
  {
755
755
  if ($destinationKey === null) {
756
756
  return null;
@@ -179,7 +179,7 @@ class Place extends Model
179
179
  /**
180
180
  * Fills empty address attributes with Google address attributes.
181
181
  *
182
- * @return \Fleetbase\FleetOps\Models\Place $this
182
+ * @return Place $this
183
183
  */
184
184
  public function fillWithGoogleAddress(\Geocoder\Provider\GoogleMaps\Model\GoogleAddress $address): Place
185
185
  {
@@ -18,8 +18,8 @@ use Fleetbase\Traits\TracksApiCredential;
18
18
  use Illuminate\Support\Arr;
19
19
 
20
20
  /**
21
- * @var \Fleetbase\LaravelMysqlSpatial\Types\Point $location
22
- * @var \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon $border
21
+ * @var Point $location
22
+ * @var 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 \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.
133
+ * @param 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 \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
136
+ * @return 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 \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.
153
+ * @param 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 \Fleetbase\LaravelMysqlSpatial\Types\MultiPolygon returns a MultiPolygon object
156
+ * @return 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 \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
183
+ * @return Point returns the centroid of the border as a Point object
184
184
  */
185
185
  public function getLocationAttribute(): Point
186
186
  {
@@ -378,7 +378,7 @@ class ServiceRate extends Model
378
378
  *
379
379
  * @return array an array of applicable service rates
380
380
  */
381
- public static function getServicableForWaypoints($waypoints = [], \Closure $queryCallback = null): array
381
+ public static function getServicableForWaypoints($waypoints = [], ?\Closure $queryCallback = null): array
382
382
  {
383
383
  $reader = new GeoJSONReader();
384
384
  $applicableServiceRates = [];
@@ -440,7 +440,7 @@ class ServiceRate extends Model
440
440
  *
441
441
  * @return array an array of applicable service rates
442
442
  */
443
- public static function getServicableForPlaces($places = [], $service = null, $currency = null, \Closure $queryCallback = null): array
443
+ public static function getServicableForPlaces($places = [], $service = null, $currency = null, ?\Closure $queryCallback = null): array
444
444
  {
445
445
  $reader = new GeoJSONReader();
446
446
  $applicableServiceRates = [];
@@ -223,7 +223,7 @@ class TrackingNumber extends Model
223
223
  throw (new \Illuminate\Database\Eloquent\ModelNotFoundException())->setModel(static::class, $id);
224
224
  }
225
225
 
226
- public function updateOwnerStatus(TrackingStatus $trackingStatus = null)
226
+ public function updateOwnerStatus(?TrackingStatus $trackingStatus = null)
227
227
  {
228
228
  $trackingStatus = $trackingStatus ?? $this->load(['status'])->getRelationValue('status');
229
229
  // update status on owner
@@ -239,7 +239,7 @@ class TrackingNumber extends Model
239
239
  return $this;
240
240
  }
241
241
 
242
- public static function insertGetUuid($values = [], Model $owner = null)
242
+ public static function insertGetUuid($values = [], ?Model $owner = null)
243
243
  {
244
244
  $instance = new static();
245
245
  $fillable = $instance->getFillable();
@@ -144,7 +144,7 @@ class TrackingStatus extends Model
144
144
  return $string;
145
145
  }
146
146
 
147
- public static function insertGetUuid($values = [], TrackingNumber $trackingNumber = null)
147
+ public static function insertGetUuid($values = [], ?TrackingNumber $trackingNumber = null)
148
148
  {
149
149
  $instance = new static();
150
150
  $fillable = $instance->getFillable();
@@ -392,11 +392,11 @@ class Vehicle extends Model
392
392
  * Updates the position of the vehicle, creating a new Position record if
393
393
  * the driver has moved more than 100 meters or if it's their first recorded position.
394
394
  *
395
- * @param \Fleetbase\FleetOps\Models\Order|null $order The order to consider when updating the position (default: null)
395
+ * @param Order|null $order The order to consider when updating the position (default: null)
396
396
  *
397
- * @return \Fleetbase\FleetOps\Models\Position|null The created Position object, or null if no new position was created
397
+ * @return Position|null The created Position object, or null if no new position was created
398
398
  */
399
- public function updatePositionWithOrderContext(Order $order = null): ?Position
399
+ public function updatePositionWithOrderContext(?Order $order = null): ?Position
400
400
  {
401
401
  $position = null;
402
402
  $lastPosition = $this->positions()->whereCompanyUuid(session('company'))->latest()->first();
@@ -182,7 +182,7 @@ class Waypoint extends Model
182
182
  return data_get($this, 'trackingNumber.last_status_code');
183
183
  }
184
184
 
185
- public static function insertGetUuid($values = [], Payload $payload = null)
185
+ public static function insertGetUuid($values = [], ?Payload $payload = null)
186
186
  {
187
187
  $instance = new static();
188
188
  $fillable = $instance->getFillable();
@@ -104,7 +104,7 @@ class Zone extends Model
104
104
  /**
105
105
  * Retrieves the location attribute as a point.
106
106
  *
107
- * @return \Fleetbase\LaravelMysqlSpatial\Types\Point returns the centroid of the border as a Point object
107
+ * @return Point returns the centroid of the border as a Point object
108
108
  */
109
109
  public function getLocationAttribute(): Point
110
110
  {
@@ -195,10 +195,10 @@ class Zone extends Model
195
195
  /**
196
196
  * Creates a polygon from a given point and radius.
197
197
  *
198
- * @param \Fleetbase\LaravelMysqlSpatial\Types\Point $point the central point from which to create the polygon
199
- * @param int $meters The radius in meters for the polygon. Default is 500 meters.
198
+ * @param Point $point the central point from which to create the polygon
199
+ * @param int $meters The radius in meters for the polygon. Default is 500 meters.
200
200
  *
201
- * @return \Fleetbase\LaravelMysqlSpatial\Types\Polygon returns a Polygon object
201
+ * @return Polygon returns a Polygon object
202
202
  */
203
203
  public static function createPolygonFromPoint(Point $point, int $meters = 500): Polygon
204
204
  {
@@ -13,11 +13,7 @@ use NotificationChannels\Apn\ApnChannel;
13
13
  use NotificationChannels\Apn\ApnMessage;
14
14
  use NotificationChannels\Fcm\FcmChannel;
15
15
  use NotificationChannels\Fcm\FcmMessage;
16
- use NotificationChannels\Fcm\Resources\AndroidConfig;
17
- use NotificationChannels\Fcm\Resources\AndroidFcmOptions;
18
- use NotificationChannels\Fcm\Resources\AndroidNotification;
19
- use NotificationChannels\Fcm\Resources\ApnsConfig;
20
- use NotificationChannels\Fcm\Resources\ApnsFcmOptions;
16
+ use NotificationChannels\Fcm\Resources\Notification as FcmNotification;
21
17
 
22
18
  class OrderAssigned extends Notification implements ShouldQueue
23
19
  {
@@ -84,7 +80,7 @@ class OrderAssigned extends Notification implements ShouldQueue
84
80
  /**
85
81
  * Get the mail representation of the notification.
86
82
  *
87
- * @return \Illuminate\Notifications\Messages\MailMessage
83
+ * @return MailMessage
88
84
  */
89
85
  public function toMail($notifiable)
90
86
  {
@@ -108,27 +104,26 @@ class OrderAssigned extends Notification implements ShouldQueue
108
104
  */
109
105
  public function toFcm($notifiable)
110
106
  {
111
- $notification = \NotificationChannels\Fcm\Resources\Notification::create()
112
- ->setTitle('New order ' . $this->order->public_id . ' assigned!')
113
- ->setBody('You have a new order assigned, tap for details.');
114
-
115
- if ($this->order->isScheduled) {
116
- $notification->setBody('You have a new order scheduled for ' . $this->order->scheduled_at);
117
- }
118
-
119
- $message = FcmMessage::create()
120
- ->setData(['id' => $this->order->public_id, 'type' => 'order_assigned'])
121
- ->setNotification($notification)
122
- ->setAndroid(
123
- AndroidConfig::create()
124
- ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
125
- ->setNotification(AndroidNotification::create()->setColor('#4391EA'))
126
- )->setApns(
127
- ApnsConfig::create()
128
- ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
129
- );
130
-
131
- return $message;
107
+ return (new FcmMessage(notification: new FcmNotification(
108
+ title: 'New order ' . $this->order->public_id . ' assigned!',
109
+ body: $this->order->isScheduled ? 'You have a new order scheduled for ' . $this->order->scheduled_at : 'You have a new order assigned, tap for details.',
110
+ )))
111
+ ->data(['id' => $this->order->public_id, 'type' => 'order_assigned'])
112
+ ->custom([
113
+ 'android' => [
114
+ 'notification' => [
115
+ 'color' => '#4391EA',
116
+ ],
117
+ 'fcm_options' => [
118
+ 'analytics_label' => 'analytics',
119
+ ],
120
+ ],
121
+ 'apns' => [
122
+ 'fcm_options' => [
123
+ 'analytics_label' => 'analytics',
124
+ ],
125
+ ],
126
+ ]);
132
127
  }
133
128
 
134
129
  /**
@@ -13,11 +13,7 @@ use NotificationChannels\Apn\ApnChannel;
13
13
  use NotificationChannels\Apn\ApnMessage;
14
14
  use NotificationChannels\Fcm\FcmChannel;
15
15
  use NotificationChannels\Fcm\FcmMessage;
16
- use NotificationChannels\Fcm\Resources\AndroidConfig;
17
- use NotificationChannels\Fcm\Resources\AndroidFcmOptions;
18
- use NotificationChannels\Fcm\Resources\AndroidNotification;
19
- use NotificationChannels\Fcm\Resources\ApnsConfig;
20
- use NotificationChannels\Fcm\Resources\ApnsFcmOptions;
16
+ use NotificationChannels\Fcm\Resources\Notification as FcmNotification;
21
17
 
22
18
  class OrderCanceled extends Notification implements ShouldQueue
23
19
  {
@@ -84,7 +80,7 @@ class OrderCanceled extends Notification implements ShouldQueue
84
80
  /**
85
81
  * Get the mail representation of the notification.
86
82
  *
87
- * @return \Illuminate\Notifications\Messages\MailMessage
83
+ * @return MailMessage
88
84
  */
89
85
  public function toMail($notifiable)
90
86
  {
@@ -105,23 +101,26 @@ class OrderCanceled extends Notification implements ShouldQueue
105
101
  */
106
102
  public function toFcm($notifiable)
107
103
  {
108
- $notification = \NotificationChannels\Fcm\Resources\Notification::create()
109
- ->setTitle('Order ' . $this->order->public_id . ' was canceled')
110
- ->setBody('No further action is necessary.');
111
-
112
- $message = FcmMessage::create()
113
- ->setData(['id' => $this->order->public_id, 'type' => 'order_canceled'])
114
- ->setNotification($notification)
115
- ->setAndroid(
116
- AndroidConfig::create()
117
- ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
118
- ->setNotification(AndroidNotification::create()->setColor('#4391EA'))
119
- )->setApns(
120
- ApnsConfig::create()
121
- ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
122
- );
123
-
124
- return $message;
104
+ return (new FcmMessage(notification: new FcmNotification(
105
+ title: 'Order ' . $this->order->public_id . ' was canceled',
106
+ body: 'No further action is necessary.',
107
+ )))
108
+ ->data(['id' => $this->order->public_id, 'type' => 'order_canceled'])
109
+ ->custom([
110
+ 'android' => [
111
+ 'notification' => [
112
+ 'color' => '#4391EA',
113
+ ],
114
+ 'fcm_options' => [
115
+ 'analytics_label' => 'analytics',
116
+ ],
117
+ ],
118
+ 'apns' => [
119
+ 'fcm_options' => [
120
+ 'analytics_label' => 'analytics',
121
+ ],
122
+ ],
123
+ ]);
125
124
  }
126
125
 
127
126
  /**
@@ -84,7 +84,7 @@ class OrderDispatchFailed extends Notification implements ShouldQueue
84
84
  /**
85
85
  * Get the mail representation of the notification.
86
86
  *
87
- * @return \Illuminate\Notifications\Messages\MailMessage
87
+ * @return MailMessage
88
88
  */
89
89
  public function toMail($notifiable)
90
90
  {
@@ -16,11 +16,7 @@ use NotificationChannels\Apn\ApnChannel;
16
16
  use NotificationChannels\Apn\ApnMessage;
17
17
  use NotificationChannels\Fcm\FcmChannel;
18
18
  use NotificationChannels\Fcm\FcmMessage;
19
- use NotificationChannels\Fcm\Resources\AndroidConfig;
20
- use NotificationChannels\Fcm\Resources\AndroidFcmOptions;
21
- use NotificationChannels\Fcm\Resources\AndroidNotification;
22
- use NotificationChannels\Fcm\Resources\ApnsConfig;
23
- use NotificationChannels\Fcm\Resources\ApnsFcmOptions;
19
+ use NotificationChannels\Fcm\Resources\Notification as FcmNotification;
24
20
 
25
21
  class OrderDispatched extends Notification implements ShouldQueue
26
22
  {
@@ -129,7 +125,7 @@ class OrderDispatched extends Notification implements ShouldQueue
129
125
  /**
130
126
  * Get the mail representation of the notification.
131
127
  *
132
- * @return \Illuminate\Notifications\Messages\MailMessage
128
+ * @return MailMessage
133
129
  */
134
130
  public function toMail($notifiable)
135
131
  {
@@ -149,23 +145,26 @@ class OrderDispatched extends Notification implements ShouldQueue
149
145
  */
150
146
  public function toFcm($notifiable)
151
147
  {
152
- $notification = \NotificationChannels\Fcm\Resources\Notification::create()
153
- ->setTitle('Order ' . $this->order->public_id . ' has been dispatched!')
154
- ->setBody('An order has just been dispatched to you and is ready to be started.');
155
-
156
- $message = FcmMessage::create()
157
- ->setData(['id' => $this->order->public_id, 'type' => 'order_dispatched'])
158
- ->setNotification($notification)
159
- ->setAndroid(
160
- AndroidConfig::create()
161
- ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
162
- ->setNotification(AndroidNotification::create()->setColor('#4391EA'))
163
- )->setApns(
164
- ApnsConfig::create()
165
- ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
166
- );
167
-
168
- return $message;
148
+ return (new FcmMessage(notification: new FcmNotification(
149
+ title: 'Order ' . $this->order->public_id . ' has been dispatched!',
150
+ body: 'An order has just been dispatched to you and is ready to be started.',
151
+ )))
152
+ ->data(['id' => $this->order->public_id, 'type' => 'order_dispatched'])
153
+ ->custom([
154
+ 'android' => [
155
+ 'notification' => [
156
+ 'color' => '#4391EA',
157
+ ],
158
+ 'fcm_options' => [
159
+ 'analytics_label' => 'analytics',
160
+ ],
161
+ ],
162
+ 'apns' => [
163
+ 'fcm_options' => [
164
+ 'analytics_label' => 'analytics',
165
+ ],
166
+ ],
167
+ ]);
169
168
  }
170
169
 
171
170
  /**
@@ -15,11 +15,7 @@ use NotificationChannels\Apn\ApnChannel;
15
15
  use NotificationChannels\Apn\ApnMessage;
16
16
  use NotificationChannels\Fcm\FcmChannel;
17
17
  use NotificationChannels\Fcm\FcmMessage;
18
- use NotificationChannels\Fcm\Resources\AndroidConfig;
19
- use NotificationChannels\Fcm\Resources\AndroidFcmOptions;
20
- use NotificationChannels\Fcm\Resources\AndroidNotification;
21
- use NotificationChannels\Fcm\Resources\ApnsConfig;
22
- use NotificationChannels\Fcm\Resources\ApnsFcmOptions;
18
+ use NotificationChannels\Fcm\Resources\Notification as FcmNotification;
23
19
 
24
20
  class OrderPing extends Notification implements ShouldQueue
25
21
  {
@@ -138,23 +134,26 @@ class OrderPing extends Notification implements ShouldQueue
138
134
  */
139
135
  public function toFcm($notifiable)
140
136
  {
141
- $notification = \NotificationChannels\Fcm\Resources\Notification::create()
142
- ->setTitle('New incoming order!')
143
- ->setBody($this->distance ? 'New order available for pickup about ' . Utils::formatMeters($this->distance, false) . ' away' : 'New order is available for pickup.');
144
-
145
- $message = FcmMessage::create()
146
- ->setData(['id' => $this->order->public_id, 'type' => 'order_ping'])
147
- ->setNotification($notification)
148
- ->setAndroid(
149
- AndroidConfig::create()
150
- ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
151
- ->setNotification(AndroidNotification::create()->setColor('#4391EA'))
152
- )->setApns(
153
- ApnsConfig::create()
154
- ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
155
- );
156
-
157
- return $message;
137
+ return (new FcmMessage(notification: new FcmNotification(
138
+ title: 'New incoming order!',
139
+ body: $this->distance ? 'New order available for pickup about ' . Utils::formatMeters($this->distance, false) . ' away' : 'New order is available for pickup.',
140
+ )))
141
+ ->data(['id' => $this->order->public_id, 'type' => 'order_ping'])
142
+ ->custom([
143
+ 'android' => [
144
+ 'notification' => [
145
+ 'color' => '#4391EA',
146
+ ],
147
+ 'fcm_options' => [
148
+ 'analytics_label' => 'analytics',
149
+ ],
150
+ ],
151
+ 'apns' => [
152
+ 'fcm_options' => [
153
+ 'analytics_label' => 'analytics',
154
+ ],
155
+ ],
156
+ ]);
158
157
  }
159
158
 
160
159
  /**
@@ -55,7 +55,7 @@ class OrderSplit extends Notification
55
55
  /**
56
56
  * Get the mail representation of the notification.
57
57
  *
58
- * @return \Illuminate\Notifications\Messages\MailMessage
58
+ * @return MailMessage
59
59
  */
60
60
  public function toMail($notifiable)
61
61
  {
@@ -47,7 +47,7 @@ class Flow
47
47
  $authored = $authoredQuery->get();
48
48
 
49
49
  // create array of configs
50
- /** @var \Illuminate\Support\Collection $configs */
50
+ /** @var Collection $configs */
51
51
  $configs = collect([...$installedExtensions, ...$authored]);
52
52
 
53
53
  // if no installed configs always place default config
@@ -79,7 +79,7 @@ class Flow
79
79
  $authored = Extension::where(['author_uuid' => session('company'), 'meta_type' => 'order_config', 'status' => 'private'])->get();
80
80
 
81
81
  // create array of configs
82
- /** @var \Illuminate\Support\Collection $configs */
82
+ /** @var Collection $configs */
83
83
  $configs = collect([...$installedExtensions, ...$authored]);
84
84
 
85
85
  // if no installed configs always place default config
@@ -111,7 +111,7 @@ class Flow
111
111
  $authored = Extension::where(['author_uuid' => $order->company_uuid, 'meta_type' => 'order_config', 'status' => 'private'])->get();
112
112
 
113
113
  // create array of configs
114
- /** @var \Illuminate\Support\Collection $configs */
114
+ /** @var Collection $configs */
115
115
  $configs = collect([...$installedExtensions, ...$authored]);
116
116
 
117
117
  // if no installed configs always place default config
@@ -259,7 +259,7 @@ class Flow
259
259
  /**
260
260
  * Returns a order flow status for the waypoint only.
261
261
  */
262
- public static function getOrderWaypointFlow(Order $order, Waypoint $waypoint = null): ?array
262
+ public static function getOrderWaypointFlow(Order $order, ?Waypoint $waypoint = null): ?array
263
263
  {
264
264
  if ($waypoint === null) {
265
265
  /** @var \Fleetbase\Models\Waypoint $waypoint */
@@ -293,7 +293,7 @@ class Flow
293
293
  /**
294
294
  * Returns a order flow status for the waypoint only.
295
295
  */
296
- public static function getOrderFlowVars(Order $order, Waypoint $currentWaypoint = null): ?array
296
+ public static function getOrderFlowVars(Order $order, ?Waypoint $currentWaypoint = null): ?array
297
297
  {
298
298
  $vars = [];
299
299
  $allWaypoints = data_get($order, 'payload.waypoints', collect());
@@ -603,7 +603,7 @@ class Flow
603
603
 
604
604
  public static function getAllDefaultOrderConfigs(): Collection
605
605
  {
606
- /** @var \Illuminate\Support\Collection $extensions */
606
+ /** @var Collection $extensions */
607
607
  $extensions = collect();
608
608
  $company = static::getCompanySession();
609
609
  $orderConfigs = config('api.types.order', []);
@@ -125,7 +125,7 @@ class Geocoding
125
125
  *
126
126
  * @throws \Exception
127
127
  */
128
- public static function reverseFromCoordinates($latitude, $longitude, string $searchQuery = null): Collection
128
+ public static function reverseFromCoordinates($latitude, $longitude, ?string $searchQuery = null): Collection
129
129
  {
130
130
  $httpClient = new Client();
131
131
  $provider = new GoogleMaps($httpClient, null, config('services.google_maps.api_key', env('GOOGLE_MAPS_API_KEY')));
@@ -169,7 +169,7 @@ class ResolvedIntegratedVendor
169
169
  return json_encode($this->toArray());
170
170
  }
171
171
 
172
- public function callback(string $callback = null, ...$callbackParams)
172
+ public function callback(?string $callback = null, ...$callbackParams)
173
173
  {
174
174
  if (!is_string($callback)) {
175
175
  return;