Files
crewli/api/app/Http/Resources/Admin/AdminOrganisationResource.php
bert.hausmans ddf26dad33 feat: platform admin backend — controllers, services, routes, tests
Add cross-organisation admin API endpoints behind role:super_admin middleware:
- AdminOrganisationController: CRUD with search, filter, billing_status management
- AdminUserController: user management with role assignment across orgs
- AdminStatsController: platform-wide aggregate statistics
- AdminActivityLogController: filterable activity log viewer
- AdminImpersonationController + ImpersonationService: user impersonation with
  token-based session management and activity logging
- BillingStatus enum, form requests, API resources, 23 feature tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 23:33:16 +02:00

33 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources\Admin;
use App\Enums\BillingStatus;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
final class AdminOrganisationResource extends JsonResource
{
public function toArray(Request $request): array
{
$billingStatus = BillingStatus::tryFrom($this->billing_status);
return [
'id' => $this->id,
'name' => $this->name,
'slug' => $this->slug,
'billing_status' => $this->billing_status,
'billing_status_label' => $billingStatus?->label(),
'settings' => $this->settings,
'events_count' => $this->whenCounted('events'),
'users_count' => $this->whenCounted('users'),
'total_persons' => $this->when(isset($this->total_persons), $this->total_persons),
'created_at' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
'deleted_at' => $this->deleted_at?->toIso8601String(),
];
}
}