boundary) { $rings = $this->boundary->getGeometries(); $ring = $rings->first(); if ($ring) { $boundaryPoints = $ring->getGeometries() ->map(fn ($p) => ['lat' => $p->latitude, 'lng' => $p->longitude]) ->all(); } } return [ 'id' => $this->uuid, 'db_id' => $this->id, 'name' => $this->name, 'code' => $this->code, 'status' => $this->status, 'description' => $this->description, 'boundary' => $boundaryPoints, 'barangay_count' => $this->whenCounted('barangays'), 'barangays' => BarangayResource::collection($this->whenLoaded('barangays')), 'created_at' => $this->created_at?->toIso8601String(), 'updated_at' => $this->updated_at?->toIso8601String(), ]; } }