Skip to content

Commit

Permalink
fix for facility shipment list
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenallen committed Feb 26, 2025
1 parent 6211456 commit 874b3be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/Http/Controllers/ResourceSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public function searchQuery(Builder $query, array $filters = [])
// this allows for customers.id to be correctly queried
if (str_contains($filter['name'], '.')) {
$relation = explode('.', $filter['name'])[0];
$query = $query->whereHas($relation, fn ($b) => $b->where($filter['name'], $filter['value']));
$relationField = explode('.', $filter['name'])[1];
$query = $query->whereHas($relation,
fn ($b) => $b->where($b->getModel()->getTable() . '.' . $relationField, $filter['value'])
);
} else {
$query = $query->where($filter['name'], $filter['value']);
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Facilities/Partials/FacilityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default function FacilityDetails({ facility }: { facility: Facility }) {
<ShipmentList
requiredFilters={[
{
name: 'facility_id',
name: 'stops.facility_id',
value: facility.id.toString() || '',
},
]}
Expand Down

0 comments on commit 874b3be

Please sign in to comment.