diff --git a/src/Http/Controllers/VoyagerBaseController.php b/src/Http/Controllers/VoyagerBaseController.php index 399ec82cd8..26c2e3e855 100644 --- a/src/Http/Controllers/VoyagerBaseController.php +++ b/src/Http/Controllers/VoyagerBaseController.php @@ -89,7 +89,7 @@ public function index(Request $request) $searchField = $dataType->name.'.'.$search->key; if ($row = $this->findSearchableRelationshipRow($dataType->rows->where('type', 'relationship'), $search->key)) { $query->whereIn( - $searchField, + $row->details->column, $row->details->model::where($row->details->label, $search_filter, $search_value)->pluck('id')->toArray() ); } else { @@ -975,7 +975,7 @@ public function relation(Request $request) protected function findSearchableRelationshipRow($relationshipRows, $searchKey) { return $relationshipRows->filter(function ($item) use ($searchKey) { - if ($item->details->column != $searchKey) { + if ($item->field != $searchKey) { return false; } if ($item->details->type != 'belongsTo') {