-
app/Http/Controllers/Traits/SearchesLinks.php
Open in GitHubtrait SearchesLinks { protected function buildDatabaseQuery(SearchRequest $request): Builder { // if ($this->emptyLists = $request->input('empty_lists', false)) { $search->doesntHave('lists'); } elseif ($this->searchLists = $request->input('only_lists', false)) { $search->whereHas('lists', function ($query) use ($request) { $field = $request->isJson() ? 'id' : 'name'; $query->whereIn($field, explode(',', $this->searchLists)); }); } } }