Преглед на файлове

feat: adiciona produtos em ligacao

ebagabee преди 1 месец
родител
ревизия
7e4b62c6d5
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      app/Services/ClassPackageService.php

+ 2 - 1
app/Services/ClassPackageService.php

@@ -15,7 +15,8 @@ public function getAll(): Collection
 
     public function getByUnit(int $unitId): Collection
     {
-        return ClassPackage::whereHas('units', fn($q) => $q->where('units.id', $unitId)->where('visible', true))
+        return ClassPackage::with('products')
+            ->whereHas('units', fn($q) => $q->where('units.id', $unitId)->where('visible', true))
             ->orderBy('name')
             ->get();
     }