A
A
axblue2017-02-27 23:45:12
Laravel
axblue, 2017-02-27 23:45:12

How to do strict whereIn filtering?

Good evening. Prompt how strictly to filter the data. That is, I have an array at the input, I need to get posts in which there is data on which I filter.

$recipes = Recipe::->whereHas('flavors', function ($query) use ($flavors_id) {
            $query->whereIn('flavor_id', $flavors_ids);
        })->get();

whereIn does not filter strictly on an array, but on a single occurrence. That is, if I have three IDs in the array, I need to get posts strictly where these three element IDs are used, and not all posts where at least one occurs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2017-02-27
@Sanasol

multiple whereHas apparently

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question