Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

Fix matching criteria and whereIn field for searchable relationship #5775

Open
wants to merge 1 commit into
base: 1.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Http/Controllers/VoyagerBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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') {
Expand Down