Order::driver() uses an inferred foreign key that doesn't exist, so dynamic:driver notifiables never resolve
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start with Order::driver() and compare it with driverAssigned(), then trace NotificationRegistry::resolveNotifiable() and Order::resolveDynamicNotifiable($property). Use the provided reproduction and the Settings → Notifications flow to verify that Dynamic: Driver resolves the assigned Driver and delivers the order notification.
Written by the indexing model from the issue text.
Description
Summary
Fleetbase\FleetOps\Models\Order::driver() is declared as belongsTo(Driver::class) with no explicit foreign key, so Laravel infers driver_uuid from the method name. The orders table has no such column — the assigned driver is stored in driver_assigned_uuid. $order->driver is therefore always null.
Impact
NotificationRegistry::resolveNotifiable() resolves dynamic:* notifiables through Order::resolveDynamicNotifiable($property), which ends in $this->{$property}. Selecting Dynamic: Driver in Settings → Notifications for any order notification resolves to null, so nobody is notified. The option is present in the UI and silently does nothing.
Versions
Fleetbase v0.7.63 (fleetops v0.6.68); same code in v0.7.58.
Reproduction
$order = Order::whereNotNull('driver_assigned_uuid')->first();
$order->driver; // null
$order->driverAssigned; // Driver model
(new Order)->driver()->getForeignKeyName(); // "driver_uuid"
Schema::hasColumn('orders', 'driver_uuid'); // false
Schema::hasColumn('orders', 'driver_assigned_uuid'); // true
Through the UI: Settings → Notifications → Order Dispatched → add "Dynamic: Driver" → dispatch an order that has a driver assigned → no notification is delivered.
Suggested fix
public function driver(): BelongsTo|Builder
{
return $this->belongsTo(Driver::class, 'driver_assigned_uuid')->without(['devices', 'vendor']);
}
driverAssigned() already works because its method name matches the column.
- Dominant language
- PHP
- Stars
- 34
- Forks
- 65
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 31
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fleetbase/fleetops
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
-
enhancement good first issue help wanted
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
enhancement good first issue help wanted
Difficulty 5/5 Over a week Newbie friendliness 30/100
All issues in fleetbase/fleetops
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·