Przeglądaj źródła

feat: adiciona qual o pacote dentro de contratos

ebagabee 1 miesiąc temu
rodzic
commit
5c78999de8

+ 1 - 0
app/Http/Resources/StudentContractResource.php

@@ -39,6 +39,7 @@ public function toArray(Request $request): array
             'payment_method'          => $this->payment_method,
             'fine_cancelled'          => $this->fine_cancelled,
             'status'                  => $this->status,
+            'package_name'            => $this->whenLoaded('classPackageUnit', fn () => $this->classPackageUnit?->name),
             'student_name'            => $this->whenLoaded('student', fn () => $this->student->name),
             'student_phone'           => $this->whenLoaded('student', fn () => $this->student->phone),
             'student_city'            => $this->whenLoaded('student', fn () => $this->student->city?->name),

+ 1 - 1
app/Services/StudentContractService.php

@@ -10,7 +10,7 @@ class StudentContractService
 {
     public function getAll(int $unitId, ?int $studentId = null): Collection
     {
-        return StudentContract::with(['student.city', 'student.state'])
+        return StudentContract::with(['student.city', 'student.state', 'classPackageUnit'])
             ->where('unit_id', $unitId)
             ->when($studentId, fn ($q) => $q->where('student_id', $studentId))
             ->orderBy('created_at', 'desc')