Aug 14, 2017
0
Level 3
Query collection with Laravel Scout and Algolia
Is it possible to search a collection returned by a pivot relationship with the search('...') function?
// Arbitrary account model instance
$account = App\Models\Account::first();
// Pulling the pivot relationship and attempting to query
// a collection of models with the search function
$account->invites()->search('...')->paginate()
I know at this point I'm really just filtering a set of data, but I didn't know if I could use the convenience of a single search() function to handle my search logic instead of customizing it every time I want to create a search method.
Also, I have implemented a query repository, so technically I could put search logic in there and call it where I need it, but I like being able to just say search();
Please or to participate in this conversation.