Browse Source

fix(contracts): show archived student data in listings

ebagabee 5 days ago
parent
commit
47ee5253bd
1 changed files with 6 additions and 1 deletions
  1. 6 1
      app/Services/StudentContractService.php

+ 6 - 1
app/Services/StudentContractService.php

@@ -34,7 +34,12 @@ public function getFranchisorByStatus(string $status, array $unitIds = []): Coll
 
     public function getAll(int $unitId, ?int $studentId = null): Collection
     {
-        return StudentContract::with(['student.city', 'student.state', 'classPackageUnit'])
+        return StudentContract::with([
+            'student' => fn ($query) => $query
+                ->withTrashed()
+                ->with(['city', 'state']),
+            'classPackageUnit',
+        ])
             ->where('unit_id', $unitId)
             ->when($studentId, fn ($q) => $q->where('student_id', $studentId))
             ->orderBy('created_at', 'desc')