I would like to filter journalists on the basis of the categories they write about (e.g. Sports, Music). When the user selects multiple categories, e.g. sports and music, it should show only the journalist which are writing about Sports AND Music. Currently, I have only managed to filter on journalists who are writing about Sports AND/OR Music.
The categories selected by the user are represented in an array:

And the combination journalists and category combination are defined in a linking table:

In my current code I make use of the whereHas command, but this only looks for each of the journalist_category_ids into the array $categoriesIds and results in the selection of the OR combination:
$journalists = Journalist::where('active', 1)
->whereHas('categories', function($q) use ($categoriesIds) {
$q->whereIn('journalist_category_id', $categoriesIds);
})->paginate(100);