Files
alrahma_sunday_school_api/app/Http/Resources/Admin/Progress/ProgressGroupResource.php
T
root 90f9857b06
API CI/CD / Validate (composer + pint) (push) Successful in 3m7s
API CI/CD / Test (PHPUnit) (push) Failing after 5m46s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
security fix and fix parent pages
2026-07-06 02:14:16 -04:00

31 lines
1.1 KiB
PHP

<?php
namespace App\Http\Resources\Admin\Progress;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ProgressGroupResource extends JsonResource
{
public function toArray(Request $request): array
{
$reports = $this['reports'] ?? [];
return [
'id' => $this['id'] ?? $this['report_id'] ?? null,
'report_id' => $this['report_id'] ?? $this['id'] ?? null,
'view_url' => $this['view_url'] ?? null,
'parent_view_url' => $this['parent_view_url'] ?? null,
'week_start' => $this['week_start'] ?? null,
'week_end' => $this['week_end'] ?? null,
'class_section_id' => $this['class_section_id'] ?? null,
'class_section_name' => $this['class_section_name'] ?? '',
'reports' => $reports, // keyed by subject for compatibility
'weekly_reports' => $this['weekly_reports'] ?? [],
'reports_array' => $this['reports_array'] ?? [],
'report_list' => $this['report_list'] ?? [],
'subjects' => $this['subjects'] ?? array_keys($reports),
];
}
}