Procházet zdrojové kódy

Devices - include devices that are assigned but is_active is false

Vijayakrishnan před 4 roky
rodič
revize
c19e544a7a
1 změnil soubory, kde provedl 8 přidání a 2 odebrání
  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'));