Quellcode durchsuchen

Devices - include devices that are assigned but is_active is false

Vijayakrishnan vor 4 Jahren
Ursprung
Commit
c19e544a7a
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      app/Http/Controllers/PatientController.php

+ 8 - 2
app/Http/Controllers/PatientController.php

@@ -26,7 +26,10 @@ class PatientController extends Controller
         $facilities = []; // Facility::where('is_active', true)->get();
         $devices = BDTDevice::where('is_active', true)->orderBy('imei', 'asc')->get();
         $devices = $devices->filter(function ($record) {
-            $matching = ClientBDTDevice::where('device_id', $record->id)->get();
+            $matching = ClientBDTDevice
+                ::where('device_id', $record->id)
+                ->where('is_active', true)
+                ->get();
             return count($matching) === 0;
         });
         $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
@@ -153,7 +156,10 @@ class PatientController extends Controller
     {
         $devices = BDTDevice::where('is_active', true)->get();
         $devices = $devices->filter(function ($record) {
-            $matching = ClientBDTDevice::where('device_id', $record->id)->get();
+            $matching = ClientBDTDevice
+                ::where('device_id', $record->id)
+                ->where('is_active', true)
+                ->get();
             return count($matching) === 0;
         });
         return view('app.patient.devices', compact('patient', 'devices'));