where('is_active', true) ->when($request->filled('city'), fn ($q) => $q->where('city', $request->string('city')->toString())) ->orderBy('name') ->get(); return $this->success([ 'establishments' => EstablishmentResource::collection($establishments), ]); } public function show(string $uuid): JsonResponse { $establishment = Establishment::query() ->where('uuid', $uuid) ->where('is_active', true) ->with(['machines' => fn ($q) => $q->orderBy('name')]) ->firstOrFail(); return $this->success([ 'establishment' => new EstablishmentResource($establishment), ]); } }