GET /organisations/{organisation}/dashboard-stats returns members,
events (with status breakdown + active count), persons, the first five
members sorted by join date, and the five most recent activity log
entries. Business logic lives in OrganisationDashboardService; access
follows OrganisationPolicy@view.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
843 B
PHP
28 lines
843 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Api\V1;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @property-read array<string, mixed> $resource
|
|
*/
|
|
final class OrganisationDashboardStatsResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'members_count' => $this->resource['members_count'],
|
|
'events_count' => $this->resource['events_count'],
|
|
'events_by_status' => $this->resource['events_by_status'],
|
|
'active_events_count' => $this->resource['active_events_count'],
|
|
'persons_count' => $this->resource['persons_count'],
|
|
'top_members' => $this->resource['top_members'],
|
|
'recent_activity' => $this->resource['recent_activity'],
|
|
];
|
|
}
|
|
}
|