This is how I ended up solving this issue:
$shops = Shop::with('services');
foreach ($service as $key => $s) {
$shops->whereHas('services', function($q) use ($s){
$q->where('id', $s);
})->orderBy('name', 'asc')
->paginate($resultsPerPage);;
}
$shops = $shops->orderBy('name', 'asc')->paginate($resultsPerPage);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community