where('is_published', true)->with('genres'); if ($r->filled('location')) { $q->where('city', 'like', '%'.$r->string('location').'%'); } if ($r->filled('max_price')) { $q->where('price_from', '<=', $r->integer('max_price')); } return view('djs.index', ['djs' => $q->orderByDesc('is_featured')->orderByDesc('average_rating')->paginate(12)->withQueryString()]); } public function show(DjProfile $djProfile) { abort_unless($djProfile->is_published, 404); return view('djs.show', ['dj' => $djProfile->load(['genres', 'reviews' => fn ($q) => $q->where('status', 'published')->latest()])]); } public function apiIndex() { return DjProfile::where('is_published', true)->with('genres')->paginate(20); } }