update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Resources\ClassProgress;
use App\Services\ApplicationUrlService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -15,7 +16,7 @@ class ClassProgressAttachmentResource extends JsonResource
'id' => $id ? (int) $id : null,
'name' => $this['name'] ?? $this->original_name ?? null,
'file_path' => $this['file_path'] ?? $this->file_path ?? null,
'download_url' => $id ? url("/api/v1/class-progress/attachments/{$id}") : null,
'download_url' => $id ? app(ApplicationUrlService::class)->forClassProgressAttachment($id) : null,
];
}
}
@@ -14,8 +14,10 @@ class ClassProgressReportResource extends JsonResource
return [
'id' => $this->id,
'teacher_id' => $this->teacher_id,
'teacher_name' => $this->teacher_name
?? trim((string) ($this->teacher?->firstname ?? '').' '.(string) ($this->teacher?->lastname ?? '')),
'class_section_id' => $this->class_section_id,
'class_section_name' => $this->classSection?->class_section_name,
'class_section_name' => $this->class_section_name ?? $this->classSection?->class_section_name,
'week_start' => $this->week_start?->format('Y-m-d'),
'week_end' => $this->week_end?->format('Y-m-d'),
'subject' => $this->subject,