|
@@ -34,7 +34,12 @@ public function getFranchisorByStatus(string $status, array $unitIds = []): Coll
|
|
|
|
|
|
|
|
public function getAll(int $unitId, ?int $studentId = null): Collection
|
|
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)
|
|
->where('unit_id', $unitId)
|
|
|
->when($studentId, fn ($q) => $q->where('student_id', $studentId))
|
|
->when($studentId, fn ($q) => $q->where('student_id', $studentId))
|
|
|
->orderBy('created_at', 'desc')
|
|
->orderBy('created_at', 'desc')
|