Skip to content

Conversation

@PremSharma-Intelegencia

Summary

The refactor introduced in commit 9dd0d8b updated OrderResource to rely on relationLoaded() checks for the driver_assigned relationship. However, eager loading for this relation was only added to internal controllers (OrderFilter and LiveController) and was missed in the public API OrderController.

As a result, driver_assigned was always returned as null in public API responses, even when a driver was assigned.

This PR adds the missing eager loading to the public API controller to align it with the existing internal request pattern.


Issue Fixed

  • Navigator app not displaying assigned drivers on adhoc orders
  • Related issue: Navigator App Issue #96

Changes

  • Added driverAssigned eager loading to:
    • query() method
    • find() method
    • setDestination() method via loadMissing
  • Ensures driver_assigned is correctly populated in public API responses

Files Changed

  • server/src/Http/Controllers/Api/v1/OrderController.php

🧠 Notes

This change maintains consistency with the eager loading strategy already used for internal requests and prevents unintended null values caused by relationLoaded() checks in OrderResource.

The refactor in commit 9dd0d8b changed OrderResource to use
relationLoaded() checks for driver_assigned, but only added
eager loading to OrderFilter (internal) and LiveController.

The public API OrderController was not updated, causing
driver_assigned to always return null in API responses.

This fix adds the missing eager loading to match the pattern
already in place for internal requests.

Fixes: Navigator app not seeing assigned drivers on adhoc orders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants