Closed TheClassified closed 6 years ago
Hello,
I am currently trying to use the search function from eloquence, for the relevancy search. However I have a many-to-many relation where I need to search on the pivot table.
Is this possible within eloquence? If so, how?
My current code of what I imagined would work.
protected function searchItems($query, $limit = 10) { return Item::with('vendors')->with('manufacturer')->with('unit')->with('items')->with('images')->search($query, [ 'vendors.name' => 10, 'vendors.pivot.vendor_part_number' => 3, ]) ->limit($limit) ->get(); }
This code provides me with the following exception "Call to undefined method Illuminate\Database\Query\Builder::pivot()"
"Call to undefined method Illuminate\Database\Query\Builder::pivot()"
not supported, sorry mate!
Hello,
I am currently trying to use the search function from eloquence, for the relevancy search. However I have a many-to-many relation where I need to search on the pivot table.
Is this possible within eloquence? If so, how?
My current code of what I imagined would work.
This code provides me with the following exception
"Call to undefined method Illuminate\Database\Query\Builder::pivot()"