Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set a Condition or Criteria to query on results to add #148

Open
dingman opened this issue Mar 9, 2018 · 0 comments
Open

How to set a Condition or Criteria to query on results to add #148

dingman opened this issue Mar 9, 2018 · 0 comments

Comments

@dingman
Copy link

dingman commented Mar 9, 2018

Love the package, thank you!

Right now I'm using this code in my Search Controller,

        $results = \App\Product::
            search()
            ->multiMatch(
                    ['sku','title'],
                    $searchTerm
            )->get();

However, I'd like to do something like this instead, so I can make sure it's only returning results where 'detail_value' IN [1],

        $results = \App\Product::
        whereHas('details', function($q) { $q->whereIn('detail_value',[1]); })->
            ->search()
            ->multiMatch(
                    ['sku','title'],
                    $searchTerm
            )->get();

Any advice how to accomplish this is greatly appreciated! TIA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant