@fleetbase/fleetops-engine 0.3.0 → 0.3.2
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.
- package/addon/components/contact-form-panel.hbs +82 -0
- package/addon/components/contact-form-panel.js +195 -0
- package/addon/components/contact-panel/details.hbs +36 -0
- package/addon/components/contact-panel/details.js +3 -0
- package/addon/components/contact-panel.hbs +52 -0
- package/addon/components/contact-panel.js +161 -0
- package/addon/components/driver-form-panel.hbs +39 -55
- package/addon/components/driver-form-panel.js +41 -0
- package/addon/components/driver-panel/details.hbs +2 -2
- package/addon/components/driver-panel.hbs +12 -10
- package/addon/components/driver-panel.js +13 -0
- package/addon/components/fleet-form-panel.hbs +28 -28
- package/addon/components/fleet-form-panel.js +150 -1
- package/addon/components/fleet-listing-panel.hbs +8 -0
- package/addon/components/fleet-listing-panel.js +34 -0
- package/addon/components/fleet-panel/details.hbs +30 -0
- package/addon/components/fleet-panel/driver-listing.hbs +72 -0
- package/addon/components/fleet-panel/driver-listing.js +149 -0
- package/addon/components/fleet-panel/vehicle-listing.hbs +72 -0
- package/addon/components/fleet-panel/vehicle-listing.js +149 -0
- package/addon/components/fleet-panel.hbs +12 -58
- package/addon/components/fleet-panel.js +148 -26
- package/addon/components/fleet-vehicle-listing.hbs +0 -1
- package/addon/components/fuel-report-form-panel.hbs +41 -0
- package/addon/components/fuel-report-form-panel.js +122 -0
- package/addon/components/fuel-report-panel/details.hbs +38 -0
- package/addon/components/fuel-report-panel.hbs +30 -0
- package/addon/components/fuel-report-panel.js +161 -0
- package/addon/components/issue-form-panel.hbs +85 -0
- package/addon/components/issue-form-panel.js +211 -0
- package/addon/components/issue-panel/details.hbs +48 -0
- package/addon/components/issue-panel.hbs +30 -0
- package/addon/components/issue-panel.js +160 -0
- package/addon/components/layout/fleet-ops-sidebar.hbs +2 -2
- package/addon/components/live-map.js +2 -0
- package/addon/components/map-container/toolbar.hbs +9 -9
- package/addon/components/map-container/topbar.hbs +1 -1
- package/addon/components/modals/issue-details.hbs +38 -0
- package/addon/components/modals/issue-from.hbs +138 -0
- package/addon/components/place-form-panel.hbs +50 -0
- package/addon/components/place-form-panel.js +134 -0
- package/addon/components/place-panel/details.hbs +95 -0
- package/addon/components/place-panel.hbs +30 -0
- package/addon/components/place-panel.js +161 -0
- package/addon/components/vehicle-form-panel.hbs +35 -44
- package/addon/components/vehicle-form-panel.js +41 -0
- package/addon/components/vehicle-panel/details.hbs +8 -2
- package/addon/components/vehicle-panel.hbs +8 -6
- package/addon/components/vendor-form-panel/create-form.hbs +114 -0
- package/addon/components/vendor-form-panel/create-form.js +158 -0
- package/addon/components/vendor-form-panel/edit-form.hbs +98 -0
- package/addon/components/vendor-form-panel/edit-form.js +51 -0
- package/addon/components/vendor-form-panel.hbs +48 -0
- package/addon/components/vendor-form-panel.js +226 -0
- package/addon/components/vendor-panel/details.hbs +77 -0
- package/addon/components/vendor-panel/details.js +12 -0
- package/addon/components/vendor-panel.hbs +58 -0
- package/addon/components/vendor-panel.js +161 -0
- package/addon/controllers/management/contacts/index/details.js +55 -0
- package/addon/controllers/management/contacts/index/edit.js +111 -0
- package/addon/controllers/management/contacts/index/new.js +88 -0
- package/addon/controllers/management/contacts/index.js +23 -128
- package/addon/controllers/management/drivers/index/new.js +2 -2
- package/addon/controllers/management/drivers/index.js +18 -32
- package/addon/controllers/management/fleets/index/details.js +53 -0
- package/addon/controllers/management/fleets/index/edit.js +75 -41
- package/addon/controllers/management/fleets/index/new.js +42 -57
- package/addon/controllers/management/fleets/index.js +0 -1
- package/addon/controllers/management/fuel-reports/index/details.js +63 -0
- package/addon/controllers/management/fuel-reports/index/edit.js +111 -0
- package/addon/controllers/management/fuel-reports/index/new.js +95 -0
- package/addon/controllers/management/fuel-reports/index.js +57 -127
- package/addon/controllers/management/issues/index/details.js +54 -0
- package/addon/controllers/management/issues/index/edit.js +111 -0
- package/addon/controllers/management/issues/index/new.js +94 -0
- package/addon/controllers/management/issues/index.js +131 -26
- package/addon/controllers/management/places/index/details.js +55 -0
- package/addon/controllers/management/places/index/edit.js +111 -0
- package/addon/controllers/management/places/index/new.js +88 -0
- package/addon/controllers/management/places/index.js +21 -182
- package/addon/controllers/management/vehicles/index/new.js +2 -6
- package/addon/controllers/management/vendors/index/details.js +55 -0
- package/addon/controllers/management/vendors/index/edit.js +111 -0
- package/addon/controllers/management/vendors/index/new.js +88 -0
- package/addon/controllers/management/vendors/index.js +43 -247
- package/addon/routes/management/contacts/index/details.js +14 -0
- package/addon/routes/management/contacts/index/edit.js +10 -0
- package/addon/routes/management/contacts/index/new.js +3 -0
- package/addon/routes/management/contacts/index.js +1 -1
- package/addon/routes/management/fleets/index/details.js +1 -1
- package/addon/routes/management/fleets/index/edit.js +1 -1
- package/addon/routes/management/fleets/index.js +1 -1
- package/addon/routes/management/fuel-reports/index/details.js +14 -0
- package/addon/routes/management/fuel-reports/index/edit.js +10 -0
- package/addon/routes/management/fuel-reports/index/new.js +3 -0
- package/addon/routes/management/fuel-reports/index.js +3 -1
- package/addon/routes/management/issues/index/details.js +14 -0
- package/addon/routes/management/issues/index/edit.js +10 -0
- package/addon/routes/management/issues/index/new.js +3 -0
- package/addon/routes/management/issues/index.js +1 -1
- package/addon/routes/management/places/index/details.js +14 -0
- package/addon/routes/management/places/index/edit.js +10 -0
- package/addon/routes/management/places/index/new.js +3 -0
- package/addon/routes/management/places/index.js +6 -1
- package/addon/routes/management/vendors/index/details.js +15 -0
- package/addon/routes/management/vendors/index/edit.js +11 -0
- package/addon/routes/management/vendors/index/new.js +3 -0
- package/addon/routes/management/vendors/index.js +1 -0
- package/addon/routes.js +27 -7
- package/addon/services/context-panel.js +60 -0
- package/addon/templates/management/contacts/index/details.hbs +1 -0
- package/addon/templates/management/contacts/index/edit.hbs +1 -0
- package/addon/templates/management/contacts/index/new.hbs +1 -0
- package/addon/templates/management/contacts/index.hbs +22 -3
- package/addon/templates/management/drivers/index.hbs +29 -5
- package/addon/templates/management/fleets/index/details.hbs +1 -1
- package/addon/templates/management/fleets/index/edit.hbs +1 -1
- package/addon/templates/management/fleets/index/new.hbs +1 -1
- package/addon/templates/management/fuel-reports/index/details.hbs +1 -0
- package/addon/templates/management/fuel-reports/index/edit.hbs +1 -0
- package/addon/templates/management/fuel-reports/index/new.hbs +1 -0
- package/addon/templates/management/fuel-reports/index.hbs +25 -4
- package/addon/templates/management/issues/index/details.hbs +1 -0
- package/addon/templates/management/issues/index/edit.hbs +1 -0
- package/addon/templates/management/issues/index/new.hbs +1 -0
- package/addon/templates/management/issues/index.hbs +5 -3
- package/addon/templates/management/places/index/details.hbs +1 -0
- package/addon/templates/management/places/index/edit.hbs +1 -0
- package/addon/templates/management/places/index/new.hbs +1 -0
- package/addon/templates/management/vendors/index/details.hbs +1 -0
- package/addon/templates/management/vendors/index/edit.hbs +1 -0
- package/addon/templates/management/vendors/index/new.hbs +1 -0
- package/addon/templates/operations/orders/index.hbs +3 -3
- package/app/components/contact-form-panel.js +1 -0
- package/app/components/contact-panel/details.js +1 -0
- package/app/components/contact-panel.js +1 -0
- package/app/components/fleet-listing-panel.js +1 -0
- package/app/components/fleet-panel/details.js +1 -0
- package/app/components/fleet-panel/driver-listing.js +1 -0
- package/app/components/fleet-panel/vehicle-listing.js +1 -0
- package/app/components/fuel-report-form-panel.js +1 -0
- package/app/components/fuel-report-panel.js +1 -0
- package/app/components/issue-form-panel.js +1 -0
- package/app/components/issue-panel.js +1 -0
- package/app/components/place-form-panel.js +1 -0
- package/app/components/place-panel.js +1 -0
- package/app/components/vendor-form-panel/create-form.js +1 -0
- package/app/components/vendor-form-panel/edit-form.js +1 -0
- package/app/components/vendor-form-panel.js +1 -0
- package/app/components/vendor-panel/details.js +1 -0
- package/app/components/vendor-panel.js +1 -0
- package/app/controllers/management/contacts/index/details.js +1 -0
- package/app/controllers/management/contacts/index/edit.js +1 -0
- package/app/controllers/management/contacts/index/new.js +1 -0
- package/app/controllers/management/fuel-reports/index/details.js +1 -0
- package/app/controllers/management/fuel-reports/index/edit.js +1 -0
- package/app/controllers/management/fuel-reports/index/new.js +1 -0
- package/app/controllers/management/issues/index/details.js +1 -0
- package/app/controllers/management/issues/index/edit.js +1 -0
- package/app/controllers/management/issues/index/new.js +1 -0
- package/app/controllers/management/places/index/details.js +1 -0
- package/app/controllers/management/places/index/edit.js +1 -0
- package/app/controllers/management/places/index/new.js +1 -0
- package/app/controllers/management/vendors/index/edit.js +1 -0
- package/app/controllers/management/vendors/index/new.js +1 -0
- package/app/routes/addon/routes/management/places/index/new.js +1 -0
- package/app/routes/management/contacts/index/details.js +1 -0
- package/app/routes/management/contacts/index/edit.js +1 -0
- package/app/routes/management/contacts/index/new.js +1 -0
- package/app/routes/management/fuel-reports/index/details.js +1 -0
- package/app/routes/management/fuel-reports/index/edit.js +1 -0
- package/app/routes/management/fuel-reports/index/new.js +1 -0
- package/app/routes/management/issues/index/details.js +1 -0
- package/app/routes/management/issues/index/edit.js +1 -0
- package/app/routes/management/issues/index/new.js +1 -0
- package/app/routes/management/places/index/details.js +1 -0
- package/app/routes/management/places/index/edit.js +1 -0
- package/app/routes/management/places/index/new.js +1 -0
- package/app/routes/management/vendors/index/details.js +1 -0
- package/app/routes/management/vendors/index/edit.js +1 -0
- package/app/routes/management/vendors/index/new.js +1 -0
- package/app/templates/addon/routes/management/places/index/new.js +1 -0
- package/app/templates/management/contacts/index/details.js +1 -0
- package/app/templates/management/contacts/index/edit.js +1 -0
- package/app/templates/management/contacts/index/new.js +1 -0
- package/app/templates/management/fuel-reports/index/details.js +1 -0
- package/app/templates/management/fuel-reports/index/edit.js +1 -0
- package/app/templates/management/fuel-reports/index/new.js +1 -0
- package/app/templates/management/issues/index/details.js +1 -0
- package/app/templates/management/issues/index/edit.js +1 -0
- package/app/templates/management/issues/index/new.js +1 -0
- package/app/templates/management/places/index/details.js +1 -0
- package/app/templates/management/places/index/edit.js +1 -0
- package/app/templates/management/places/index/new.js +1 -0
- package/app/templates/management/vendors/index/details.js +1 -0
- package/app/templates/management/vendors/index/edit.js +1 -0
- package/app/templates/management/vendors/index/new.js +1 -0
- package/composer.json +2 -2
- package/config/environment.js +2 -1
- package/extension.json +1 -1
- package/package.json +4 -3
- package/server/migrations/2023_11_03_072503_refactor_issues_table_columns.php +42 -0
- package/server/migrations/2023_11_06_040645_refactor_fuel_reports_table.php +38 -0
- package/server/src/Casts/Point.php +15 -1
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +33 -15
- package/server/src/Http/Filter/FleetFilter.php +7 -0
- package/server/src/Http/Filter/FuelReportFilter.php +58 -0
- package/server/src/Http/Filter/IssueFilter.php +69 -0
- package/server/src/Http/Filter/VehicleFilter.php +10 -0
- package/server/src/Http/Middleware/TransformLocationMiddleware.php +48 -0
- package/server/src/Http/Resources/v1/Driver.php +1 -0
- package/server/src/Http/Resources/v1/Fleet.php +20 -21
- package/server/src/Http/Resources/v1/FuelReport.php +37 -35
- package/server/src/Http/Resources/v1/Issue.php +77 -0
- package/server/src/Http/Resources/v1/ParentFleet.php +60 -0
- package/server/src/Http/Resources/v1/SubFleet.php +60 -0
- package/server/src/Http/Resources/v1/Vehicle.php +4 -2
- package/server/src/Integrations/Lalamove/Lalamove.php +6 -6
- package/server/src/Models/Contact.php +7 -0
- package/server/src/Models/Driver.php +1 -1
- package/server/src/Models/Fleet.php +37 -4
- package/server/src/Models/FuelReport.php +53 -3
- package/server/src/Models/Issue.php +106 -7
- package/server/src/Models/Vehicle.php +1 -1
- package/server/src/Models/VehicleDevice.php +3 -1
- package/server/src/Models/VehicleDeviceEvent.php +7 -3
- package/server/src/Notifications/OrderAssigned.php +15 -0
- package/server/src/Notifications/OrderCanceled.php +15 -0
- package/server/src/Notifications/OrderDispatchFailed.php +15 -0
- package/server/src/Notifications/OrderDispatched.php +15 -0
- package/server/src/Notifications/OrderPing.php +15 -0
- package/server/src/Notifications/OrderSplit.php +26 -5
- package/server/src/Providers/FleetOpsServiceProvider.php +22 -0
- package/server/src/Providers/NotificationServiceProvider.php +43 -0
- package/server/src/routes.php +2 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
8
|
+
|
|
9
|
+
class Issue extends FleetbaseResource
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Transform the resource into an array.
|
|
13
|
+
*
|
|
14
|
+
* @param \Illuminate\Http\Request $request
|
|
15
|
+
*
|
|
16
|
+
* @return array
|
|
17
|
+
*/
|
|
18
|
+
public function toArray($request)
|
|
19
|
+
{
|
|
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
|
+
'issue_id' => $this->when(Http::isInternalRequest(), $this->issue_id),
|
|
25
|
+
'driver_uuid' => $this->when(Http::isInternalRequest(), $this->driver_uuid),
|
|
26
|
+
'vehicle_uuid' => $this->when(Http::isInternalRequest(), $this->vehicle_uuid),
|
|
27
|
+
'assigned_to_uuid' => $this->when(Http::isInternalRequest(), $this->assigned_to_uuid),
|
|
28
|
+
'reported_by_uuid' => $this->when(Http::isInternalRequest(), $this->reported_by_uuid),
|
|
29
|
+
'assignee' => $this->whenLoaded('assignee', $this->assignee),
|
|
30
|
+
'reporter' => $this->whenLoaded('reporter', $this->reporter),
|
|
31
|
+
'vehicle' => $this->whenLoaded('vehicle', new Vehicle($this->vehicle)),
|
|
32
|
+
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
33
|
+
'driver_name' => $this->driver_name,
|
|
34
|
+
'vehicle_name' => $this->vehicle_name,
|
|
35
|
+
'assignee_name' => $this->assignee_name,
|
|
36
|
+
'reporter_name' => $this->reporter_name,
|
|
37
|
+
'issue_id' => $this->issue_id,
|
|
38
|
+
'report' => $this->report,
|
|
39
|
+
'priority' => $this->priority,
|
|
40
|
+
'meta' => data_get($this, 'meta', []),
|
|
41
|
+
'type' => $this->type,
|
|
42
|
+
'category' => $this->category,
|
|
43
|
+
'status' => $this->status,
|
|
44
|
+
'location' => data_get($this, 'location', new Point(0, 0)),
|
|
45
|
+
'resolved_at' => $this->resolved_at,
|
|
46
|
+
'updated_at' => $this->updated_at,
|
|
47
|
+
'created_at' => $this->created_at,
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Transform the resource into an webhook payload.
|
|
53
|
+
*
|
|
54
|
+
* @return array
|
|
55
|
+
*/
|
|
56
|
+
public function toWebhookPayload()
|
|
57
|
+
{
|
|
58
|
+
return [
|
|
59
|
+
'id' => $this->public_id,
|
|
60
|
+
'reporter' => data_get($this, 'reportedBy.public_id'),
|
|
61
|
+
'assignee' => data_get($this, 'assignedTo.public_id'),
|
|
62
|
+
'driver' => data_get($this, 'driver.public_id'),
|
|
63
|
+
'vehicle' => data_get($this, 'vehicle.public_id'),
|
|
64
|
+
'issue_id' => $this->issue_id,
|
|
65
|
+
'report' => $this->report,
|
|
66
|
+
'priority' => $this->priority,
|
|
67
|
+
'meta' => data_get($this, 'meta', []),
|
|
68
|
+
'type' => $this->type,
|
|
69
|
+
'category' => $this->category,
|
|
70
|
+
'status' => $this->status,
|
|
71
|
+
'location' => data_get($this, 'location', new Point(0, 0)),
|
|
72
|
+
'resolved_at' => $this->resolved_at,
|
|
73
|
+
'updated_at' => $this->updated_at,
|
|
74
|
+
'created_at' => $this->created_at,
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class ParentFleet extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return [
|
|
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
|
+
'name' => $this->name,
|
|
24
|
+
'task' => $this->task ?? null,
|
|
25
|
+
'status' => $this->status ?? null,
|
|
26
|
+
'drivers_count' => $this->when(Http::isInternalRequest(), $this->drivers_count),
|
|
27
|
+
'drivers_online_count' => $this->when(Http::isInternalRequest(), $this->drivers_online_count),
|
|
28
|
+
'vehicles_count' => $this->when(Http::isInternalRequest(), $this->vehicles_count),
|
|
29
|
+
'vehicles_online_count' => $this->when(Http::isInternalRequest(), $this->vehicles_online_count),
|
|
30
|
+
'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
|
|
31
|
+
'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
|
|
32
|
+
'vendor' => $this->whenLoaded('vendor', new Vendor($this->vendor)),
|
|
33
|
+
'drivers' => $this->whenLoaded('drivers', Driver::collection($this->drivers()->without(['driverAssigned'])->with(Http::isInternalRequest() ? ['jobs'] : [])->get())),
|
|
34
|
+
'vehicles' => $this->whenLoaded('vehicles', Vehicle::collection($this->vehicles)),
|
|
35
|
+
'subfleets' => [],
|
|
36
|
+
'type' => 'fleet',
|
|
37
|
+
'updated_at' => $this->updated_at,
|
|
38
|
+
'created_at' => $this->created_at,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Transform the resource into an webhook payload.
|
|
44
|
+
*
|
|
45
|
+
* @return array
|
|
46
|
+
*/
|
|
47
|
+
public function toWebhookPayload()
|
|
48
|
+
{
|
|
49
|
+
return [
|
|
50
|
+
'id' => $this->public_id,
|
|
51
|
+
'name' => $this->name,
|
|
52
|
+
'task' => $this->task ?? null,
|
|
53
|
+
'status' => $this->status ?? null,
|
|
54
|
+
'service_area' => $this->when($this->serviceArea, data_get($this, 'serviceArea.public_id')),
|
|
55
|
+
'zone' => $this->when($this->zone, data_get($this, 'zone.public_id')),
|
|
56
|
+
'updated_at' => $this->updated_at,
|
|
57
|
+
'created_at' => $this->created_at,
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
|
+
use Fleetbase\Support\Http;
|
|
7
|
+
|
|
8
|
+
class SubFleet extends FleetbaseResource
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Transform the resource into an array.
|
|
12
|
+
*
|
|
13
|
+
* @param \Illuminate\Http\Request $request
|
|
14
|
+
*
|
|
15
|
+
* @return array
|
|
16
|
+
*/
|
|
17
|
+
public function toArray($request)
|
|
18
|
+
{
|
|
19
|
+
return [
|
|
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
|
+
'name' => $this->name,
|
|
24
|
+
'task' => $this->task ?? null,
|
|
25
|
+
'status' => $this->status ?? null,
|
|
26
|
+
'drivers_count' => $this->when(Http::isInternalRequest(), $this->drivers_count),
|
|
27
|
+
'drivers_online_count' => $this->when(Http::isInternalRequest(), $this->drivers_online_count),
|
|
28
|
+
'vehicles_count' => $this->when(Http::isInternalRequest(), $this->vehicles_count),
|
|
29
|
+
'vehicles_online_count' => $this->when(Http::isInternalRequest(), $this->vehicles_online_count),
|
|
30
|
+
'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
|
|
31
|
+
'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
|
|
32
|
+
'vendor' => $this->whenLoaded('vendor', new Vendor($this->vendor)),
|
|
33
|
+
'drivers' => $this->whenLoaded('drivers', Driver::collection($this->drivers()->without(['driverAssigned'])->with(Http::isInternalRequest() ? ['jobs'] : [])->get())),
|
|
34
|
+
'vehicles' => $this->whenLoaded('vehicles', Vehicle::collection($this->vehicles)),
|
|
35
|
+
'subfleets' => [],
|
|
36
|
+
'type' => 'fleet',
|
|
37
|
+
'updated_at' => $this->updated_at,
|
|
38
|
+
'created_at' => $this->created_at,
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Transform the resource into an webhook payload.
|
|
44
|
+
*
|
|
45
|
+
* @return array
|
|
46
|
+
*/
|
|
47
|
+
public function toWebhookPayload()
|
|
48
|
+
{
|
|
49
|
+
return [
|
|
50
|
+
'id' => $this->public_id,
|
|
51
|
+
'name' => $this->name,
|
|
52
|
+
'task' => $this->task ?? null,
|
|
53
|
+
'status' => $this->status ?? null,
|
|
54
|
+
'service_area' => $this->when($this->serviceArea, data_get($this, 'serviceArea.public_id')),
|
|
55
|
+
'zone' => $this->when($this->zone, data_get($this, 'zone.public_id')),
|
|
56
|
+
'updated_at' => $this->updated_at,
|
|
57
|
+
'created_at' => $this->created_at,
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -23,13 +23,14 @@ class Vehicle extends FleetbaseResource
|
|
|
23
23
|
'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
|
|
24
24
|
'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
|
|
25
25
|
'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
|
|
26
|
+
'photo_uuid' => $this->when(Http::isInternalRequest(), $this->photo_uuid),
|
|
26
27
|
'internal_id' => $this->internal_id,
|
|
27
28
|
'name' => $this->display_name,
|
|
28
29
|
'display_name' => $this->when(Http::isInternalRequest(), $this->display_name),
|
|
29
30
|
'vin' => $this->vin ?? null,
|
|
30
31
|
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
31
32
|
'devices' => $this->whenLoaded('devices', $this->devices),
|
|
32
|
-
'
|
|
33
|
+
'photo_url' => $this->photoUrl,
|
|
33
34
|
'avatar_url' => $this->avatar_url,
|
|
34
35
|
'make' => $this->make,
|
|
35
36
|
'model' => $this->model,
|
|
@@ -65,7 +66,8 @@ class Vehicle extends FleetbaseResource
|
|
|
65
66
|
'name' => $this->name,
|
|
66
67
|
'vin' => $this->vin ?? null,
|
|
67
68
|
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
68
|
-
'
|
|
69
|
+
'photo_url' => $this->photoUrl,
|
|
70
|
+
'avatar_url' => $this->avatar_url,
|
|
69
71
|
'make' => $this->make,
|
|
70
72
|
'model' => $this->model,
|
|
71
73
|
'year' => $this->year,
|
|
@@ -44,17 +44,17 @@ class Lalamove
|
|
|
44
44
|
/**
|
|
45
45
|
* API Key.
|
|
46
46
|
*/
|
|
47
|
-
private string $apiKey;
|
|
47
|
+
private ?string $apiKey;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* API Secret.
|
|
51
51
|
*/
|
|
52
|
-
private string $apiSecret;
|
|
52
|
+
private ?string $apiSecret;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Applicable request ID.
|
|
56
56
|
*/
|
|
57
|
-
private string $requestId;
|
|
57
|
+
private ?string $requestId;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Applicable options.
|
|
@@ -272,7 +272,7 @@ class Lalamove
|
|
|
272
272
|
return $this;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
private static function sign($timestamp, string $apiSecret, string $requestMethod, string $requestPath, string $requestBody)
|
|
275
|
+
private static function sign($timestamp, ?string $apiSecret, ?string $requestMethod, ?string $requestPath, ?string $requestBody)
|
|
276
276
|
{
|
|
277
277
|
$requestMethod = strtoupper($requestMethod);
|
|
278
278
|
$rawSignature = "$timestamp\r\n$requestMethod\r\n$requestPath\r\n\r\n$requestBody";
|
|
@@ -281,7 +281,7 @@ class Lalamove
|
|
|
281
281
|
return $signature;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
private function createSignature($timestamp, string $requestMethod, string $requestPath, string $requestBody)
|
|
284
|
+
private function createSignature($timestamp, ?string $requestMethod, ?string $requestPath, ?string $requestBody)
|
|
285
285
|
{
|
|
286
286
|
$requestPath = '/' . $this->namespace . '/' . $requestPath;
|
|
287
287
|
$apiSecret = $this->apiSecret;
|
|
@@ -289,7 +289,7 @@ class Lalamove
|
|
|
289
289
|
return static::sign($timestamp, $apiSecret, $requestMethod, $requestPath, $requestBody);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
private function getAuthorizationKey(string $method, string $path, string $body)
|
|
292
|
+
private function getAuthorizationKey(?string $method, ?string $path, ?string $body)
|
|
293
293
|
{
|
|
294
294
|
$key = $this->apiKey;
|
|
295
295
|
$timestamp = floor(microtime(true) * 1000);
|
|
@@ -84,6 +84,13 @@ class Contact extends Model
|
|
|
84
84
|
*/
|
|
85
85
|
protected $hidden = ['photo'];
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Filterable attributes/parameters.
|
|
89
|
+
*
|
|
90
|
+
* @var array
|
|
91
|
+
*/
|
|
92
|
+
protected $filterParams = ['place_uuid', 'customer_type', 'facilitator_type', 'place'];
|
|
93
|
+
|
|
87
94
|
/**
|
|
88
95
|
* Properties which activity needs to be logged.
|
|
89
96
|
*
|
|
@@ -144,7 +144,7 @@ class Driver extends Model
|
|
|
144
144
|
*
|
|
145
145
|
* @var array
|
|
146
146
|
*/
|
|
147
|
-
protected $filterParams = ['vendor', 'facilitator', 'customer', 'fleet'];
|
|
147
|
+
protected $filterParams = ['vendor', 'facilitator', 'customer', 'fleet', 'photo_uuid', 'avatar_uuid'];
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Properties which activity needs to be logged.
|
|
@@ -9,6 +9,7 @@ use Fleetbase\Traits\HasUuid;
|
|
|
9
9
|
use Fleetbase\Traits\Searchable;
|
|
10
10
|
use Fleetbase\Traits\SendsWebhooks;
|
|
11
11
|
use Fleetbase\Traits\TracksApiCredential;
|
|
12
|
+
use Illuminate\Notifications\Notifiable;
|
|
12
13
|
use Spatie\Activitylog\Traits\LogsActivity;
|
|
13
14
|
use Spatie\Sluggable\HasSlug;
|
|
14
15
|
use Spatie\Sluggable\SlugOptions;
|
|
@@ -23,6 +24,7 @@ class Fleet extends Model
|
|
|
23
24
|
use Searchable;
|
|
24
25
|
use HasSlug;
|
|
25
26
|
use LogsActivity;
|
|
27
|
+
use Notifiable;
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* The database table used by the model.
|
|
@@ -73,6 +75,9 @@ class Fleet extends Model
|
|
|
73
75
|
*/
|
|
74
76
|
protected static $logName = 'fleet';
|
|
75
77
|
|
|
78
|
+
/**
|
|
79
|
+
* The flug options for this model.
|
|
80
|
+
*/
|
|
76
81
|
public function getSlugOptions(): SlugOptions
|
|
77
82
|
{
|
|
78
83
|
return SlugOptions::create()
|
|
@@ -106,7 +111,7 @@ class Fleet extends Model
|
|
|
106
111
|
*
|
|
107
112
|
* @var array
|
|
108
113
|
*/
|
|
109
|
-
protected $appends = ['photo_url', 'drivers_count', 'drivers_online_count'];
|
|
114
|
+
protected $appends = ['photo_url', 'drivers_count', 'drivers_online_count', 'vehicles_count', 'vehicles_online_count'];
|
|
110
115
|
|
|
111
116
|
/**
|
|
112
117
|
* The attributes excluded from the model's JSON form.
|
|
@@ -152,7 +157,15 @@ class Fleet extends Model
|
|
|
152
157
|
*/
|
|
153
158
|
public function parentFleet()
|
|
154
159
|
{
|
|
155
|
-
return $this->belongsTo(Fleet::class)->
|
|
160
|
+
return $this->belongsTo(Fleet::class)->without(['subFleets']);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
165
|
+
*/
|
|
166
|
+
public function subFleets()
|
|
167
|
+
{
|
|
168
|
+
return $this->hasMany(Fleet::class, 'parent_fleet_uuid', 'uuid')->without(['parentFleet']);
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
/**
|
|
@@ -178,7 +191,7 @@ class Fleet extends Model
|
|
|
178
191
|
*/
|
|
179
192
|
public function getPhotoUrlAttribute()
|
|
180
193
|
{
|
|
181
|
-
return data_get($this, 'photo.
|
|
194
|
+
return data_get($this, 'photo.url', 'https://s3.ap-northeast-2.amazonaws.com/fleetbase/public/default-fleet.png');
|
|
182
195
|
}
|
|
183
196
|
|
|
184
197
|
/**
|
|
@@ -192,7 +205,7 @@ class Fleet extends Model
|
|
|
192
205
|
}
|
|
193
206
|
|
|
194
207
|
/**
|
|
195
|
-
* Get the number of drivers in fleet.
|
|
208
|
+
* Get the number of online drivers in fleet.
|
|
196
209
|
*
|
|
197
210
|
* @return int
|
|
198
211
|
*/
|
|
@@ -200,4 +213,24 @@ class Fleet extends Model
|
|
|
200
213
|
{
|
|
201
214
|
return $this->drivers()->where('online', 1)->count();
|
|
202
215
|
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get the number of vehicles in fleet.
|
|
219
|
+
*
|
|
220
|
+
* @return int
|
|
221
|
+
*/
|
|
222
|
+
public function getVehiclesCountAttribute()
|
|
223
|
+
{
|
|
224
|
+
return $this->vehicles()->count();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get the number of online vehicles in fleet.
|
|
229
|
+
*
|
|
230
|
+
* @return int
|
|
231
|
+
*/
|
|
232
|
+
public function getVehiclesOnlineCountAttribute()
|
|
233
|
+
{
|
|
234
|
+
return $this->vehicles()->where('online', 1)->count();
|
|
235
|
+
}
|
|
203
236
|
}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Fleetbase\FleetOps\Models;
|
|
4
4
|
|
|
5
|
+
use Fleetbase\Casts\Json;
|
|
5
6
|
use Fleetbase\FleetOps\Casts\Point;
|
|
6
7
|
use Fleetbase\FleetOps\Support\Utils;
|
|
7
8
|
use Fleetbase\Models\Model;
|
|
8
9
|
use Fleetbase\Traits\HasApiModelBehavior;
|
|
9
10
|
use Fleetbase\Traits\HasPublicId;
|
|
10
11
|
use Fleetbase\Traits\HasUuid;
|
|
12
|
+
use Fleetbase\Traits\Searchable;
|
|
11
13
|
use Fleetbase\Traits\TracksApiCredential;
|
|
12
14
|
use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
|
|
13
15
|
|
|
@@ -18,6 +20,7 @@ class FuelReport extends Model
|
|
|
18
20
|
use HasPublicId;
|
|
19
21
|
use HasApiModelBehavior;
|
|
20
22
|
use SpatialTrait;
|
|
23
|
+
use Searchable;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* The database table used by the model.
|
|
@@ -38,14 +41,27 @@ class FuelReport extends Model
|
|
|
38
41
|
*
|
|
39
42
|
* @var array
|
|
40
43
|
*/
|
|
41
|
-
protected $searchableColumns = [];
|
|
44
|
+
protected $searchableColumns = ['report', 'vehicle.name', 'driver.name'];
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* The attributes that are mass assignable.
|
|
45
48
|
*
|
|
46
49
|
* @var array
|
|
47
50
|
*/
|
|
48
|
-
protected $fillable = [
|
|
51
|
+
protected $fillable = [
|
|
52
|
+
'company_uuid',
|
|
53
|
+
'driver_uuid',
|
|
54
|
+
'vehicle_uuid',
|
|
55
|
+
'reported_by_uuid',
|
|
56
|
+
'report',
|
|
57
|
+
'odometer',
|
|
58
|
+
'location',
|
|
59
|
+
'amount',
|
|
60
|
+
'currency',
|
|
61
|
+
'volume',
|
|
62
|
+
'metric_unit',
|
|
63
|
+
'meta',
|
|
64
|
+
];
|
|
49
65
|
|
|
50
66
|
/**
|
|
51
67
|
* The attributes that are spatial columns.
|
|
@@ -61,6 +77,7 @@ class FuelReport extends Model
|
|
|
61
77
|
*/
|
|
62
78
|
protected $casts = [
|
|
63
79
|
'location' => Point::class,
|
|
80
|
+
'meta' => Json::class,
|
|
64
81
|
];
|
|
65
82
|
|
|
66
83
|
/**
|
|
@@ -68,7 +85,7 @@ class FuelReport extends Model
|
|
|
68
85
|
*
|
|
69
86
|
* @var array
|
|
70
87
|
*/
|
|
71
|
-
protected $appends = ['vehicle_name', 'driver_name'];
|
|
88
|
+
protected $appends = ['vehicle_name', 'driver_name', 'reporter_name'];
|
|
72
89
|
|
|
73
90
|
/**
|
|
74
91
|
* The attributes excluded from the model's JSON form.
|
|
@@ -77,6 +94,13 @@ class FuelReport extends Model
|
|
|
77
94
|
*/
|
|
78
95
|
protected $hidden = ['driver', 'vehicle'];
|
|
79
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Filterable attributes/parameters.
|
|
99
|
+
*
|
|
100
|
+
* @var array
|
|
101
|
+
*/
|
|
102
|
+
protected $filterParams = ['type', 'reporter'];
|
|
103
|
+
|
|
80
104
|
/**
|
|
81
105
|
* Set the parcel fee as only numbers.
|
|
82
106
|
*
|
|
@@ -103,6 +127,22 @@ class FuelReport extends Model
|
|
|
103
127
|
return $this->belongsTo(Vehicle::class)->without(['driver']);
|
|
104
128
|
}
|
|
105
129
|
|
|
130
|
+
/**
|
|
131
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
132
|
+
*/
|
|
133
|
+
public function reportedBy()
|
|
134
|
+
{
|
|
135
|
+
return $this->belongsTo(\Fleetbase\Models\User::class);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
140
|
+
*/
|
|
141
|
+
public function reporter()
|
|
142
|
+
{
|
|
143
|
+
return $this->belongsTo(\Fleetbase\Models\User::class, 'reported_by_uuid');
|
|
144
|
+
}
|
|
145
|
+
|
|
106
146
|
/**
|
|
107
147
|
* Get the driver's name assigned to vehicle.
|
|
108
148
|
*
|
|
@@ -122,4 +162,14 @@ class FuelReport extends Model
|
|
|
122
162
|
{
|
|
123
163
|
return data_get($this, 'vehicle.display_name');
|
|
124
164
|
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Get the vehicless name.
|
|
168
|
+
*
|
|
169
|
+
* @var Model
|
|
170
|
+
*/
|
|
171
|
+
public function getReporterNameAttribute()
|
|
172
|
+
{
|
|
173
|
+
return data_get($this, 'reportedBy.name');
|
|
174
|
+
}
|
|
125
175
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Fleetbase\FleetOps\Models;
|
|
4
4
|
|
|
5
|
+
use Fleetbase\Casts\Json;
|
|
5
6
|
use Fleetbase\FleetOps\Casts\Point;
|
|
6
7
|
use Fleetbase\Models\Model;
|
|
7
8
|
use Fleetbase\Traits\HasApiModelBehavior;
|
|
@@ -9,6 +10,7 @@ use Fleetbase\Traits\HasPublicId;
|
|
|
9
10
|
use Fleetbase\Traits\HasUuid;
|
|
10
11
|
use Fleetbase\Traits\TracksApiCredential;
|
|
11
12
|
use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
|
|
13
|
+
use Illuminate\Support\Str;
|
|
12
14
|
|
|
13
15
|
class Issue extends Model
|
|
14
16
|
{
|
|
@@ -46,18 +48,19 @@ class Issue extends Model
|
|
|
46
48
|
*/
|
|
47
49
|
protected $fillable = [
|
|
48
50
|
'_key',
|
|
51
|
+
'public_id',
|
|
49
52
|
'company_uuid',
|
|
50
53
|
'reported_by_uuid',
|
|
51
|
-
'vehicle_uuid',
|
|
52
54
|
'assigned_to_uuid',
|
|
55
|
+
'vehicle_uuid',
|
|
56
|
+
'driver_uuid',
|
|
53
57
|
'issue_id',
|
|
54
|
-
'odometer',
|
|
55
58
|
'location',
|
|
56
|
-
'
|
|
57
|
-
'longitude',
|
|
59
|
+
'category',
|
|
58
60
|
'type',
|
|
59
61
|
'report',
|
|
60
62
|
'priority',
|
|
63
|
+
'meta',
|
|
61
64
|
'resolved_at',
|
|
62
65
|
'status',
|
|
63
66
|
];
|
|
@@ -67,16 +70,32 @@ class Issue extends Model
|
|
|
67
70
|
*
|
|
68
71
|
* @var array
|
|
69
72
|
*/
|
|
70
|
-
protected $spatialFields = [
|
|
71
|
-
|
|
73
|
+
protected $spatialFields = ['location'];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The attributes that should be cast to native types.
|
|
77
|
+
*
|
|
78
|
+
* @var array
|
|
79
|
+
*/
|
|
80
|
+
protected $casts = [
|
|
81
|
+
'location' => Point::class,
|
|
82
|
+
'meta' => Json::class,
|
|
83
|
+
'resolved_at' => 'date',
|
|
72
84
|
];
|
|
73
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Filterable attributes/parameters.
|
|
88
|
+
*
|
|
89
|
+
* @var array
|
|
90
|
+
*/
|
|
91
|
+
protected $filterParams = ['assignee', 'reporter'];
|
|
92
|
+
|
|
74
93
|
/**
|
|
75
94
|
* Dynamic attributes that are appended to object.
|
|
76
95
|
*
|
|
77
96
|
* @var array
|
|
78
97
|
*/
|
|
79
|
-
protected $appends = [];
|
|
98
|
+
protected $appends = ['driver_name', 'vehicle_name', 'assignee_name', 'reporter_name'];
|
|
80
99
|
|
|
81
100
|
/**
|
|
82
101
|
* The attributes excluded from the model's JSON form.
|
|
@@ -93,6 +112,14 @@ class Issue extends Model
|
|
|
93
112
|
return $this->belongsTo(\Fleetbase\Models\User::class);
|
|
94
113
|
}
|
|
95
114
|
|
|
115
|
+
/**
|
|
116
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
117
|
+
*/
|
|
118
|
+
public function reporter()
|
|
119
|
+
{
|
|
120
|
+
return $this->belongsTo(\Fleetbase\Models\User::class, 'reported_by_uuid');
|
|
121
|
+
}
|
|
122
|
+
|
|
96
123
|
/**
|
|
97
124
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
98
125
|
*/
|
|
@@ -101,6 +128,14 @@ class Issue extends Model
|
|
|
101
128
|
return $this->belongsTo(\Fleetbase\Models\User::class);
|
|
102
129
|
}
|
|
103
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
133
|
+
*/
|
|
134
|
+
public function assignee()
|
|
135
|
+
{
|
|
136
|
+
return $this->belongsTo(\Fleetbase\Models\User::class, 'assigned_to_uuid');
|
|
137
|
+
}
|
|
138
|
+
|
|
104
139
|
/**
|
|
105
140
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
106
141
|
*/
|
|
@@ -108,4 +143,68 @@ class Issue extends Model
|
|
|
108
143
|
{
|
|
109
144
|
return $this->belongsTo(Vehicle::class);
|
|
110
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
149
|
+
*/
|
|
150
|
+
public function driver()
|
|
151
|
+
{
|
|
152
|
+
return $this->belongsTo(Driver::class);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Set a default status if none is provided, and always dasherize status input.
|
|
157
|
+
*
|
|
158
|
+
* @param string $value
|
|
159
|
+
*
|
|
160
|
+
* @return void
|
|
161
|
+
*/
|
|
162
|
+
public function setStatusAttribute($value)
|
|
163
|
+
{
|
|
164
|
+
if (empty($value)) {
|
|
165
|
+
$this->attributes['status'] = 'pending';
|
|
166
|
+
} else {
|
|
167
|
+
$this->attributes['status'] = Str::slug($value);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get the driver's name assigned to vehicle.
|
|
173
|
+
*
|
|
174
|
+
* @return string
|
|
175
|
+
*/
|
|
176
|
+
public function getDriverNameAttribute()
|
|
177
|
+
{
|
|
178
|
+
return data_get($this, 'driver.name');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get the vehicless name.
|
|
183
|
+
*
|
|
184
|
+
* @return string
|
|
185
|
+
*/
|
|
186
|
+
public function getVehicleNameAttribute()
|
|
187
|
+
{
|
|
188
|
+
return data_get($this, 'vehicle.display_name');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Get the reporter name.
|
|
193
|
+
*
|
|
194
|
+
* @return string
|
|
195
|
+
*/
|
|
196
|
+
public function getReporterNameAttribute()
|
|
197
|
+
{
|
|
198
|
+
return data_get($this, 'reporter.name');
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get the assignee name.
|
|
203
|
+
*
|
|
204
|
+
* @return string
|
|
205
|
+
*/
|
|
206
|
+
public function getAssigneeNameAttribute()
|
|
207
|
+
{
|
|
208
|
+
return data_get($this, 'assignee.name');
|
|
209
|
+
}
|
|
111
210
|
}
|