Skip to content

Add getRegionCount to WorldHeritageQueryService Acceptance Criteria #370

@zigzagdev

Description

@zigzagdev

Acceptance Criteria

  • WorldHeritageQueryService has a getRegionCount method
  • Returns a grouped count of heritage sites by study_region

Tasks

  • Add getRegionCount(): array to WorldHeritageQueryService
  • Group and count records by study_region from the WorldHeritage model
public function getRegionCount(): array
{
    return WorldHeritage::query()
        ->whereNotNull('study_region')
        ->groupBy('study_region')
        ->selectRaw('study_region, COUNT(*) as count')
        ->pluck('count', 'study_region')
        ->toArray();
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions