durong пре 5 година
родитељ
комит
601004587e
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      app/Repositories/Behavior/GenaralRecordRepository.php

+ 6 - 4
app/Repositories/Behavior/GenaralRecordRepository.php

@@ -1,5 +1,6 @@
 <?php
 namespace App\Repositories\Behavior;
+use App\Models\Behavior;
 use App\Models\GeneralRecord;
 
 /**
@@ -11,9 +12,10 @@ use App\Models\GeneralRecord;
 
 class GenaralRecordRepository
 {
-    public function __construct(GeneralRecord $generalRecord)
+    public function __construct(GeneralRecord $generalRecord,Behavior $behavior)
     {
         $this->generalRecord = $generalRecord;
+        $this->behavior = $behavior;
     }
 
     public function lists($request)
@@ -34,10 +36,10 @@ class GenaralRecordRepository
         }
 
         if(isset($request['behavior_identification'])){
-            if ($request['type'] == 1){
-
+            $virus_id = $this->behavior->select('virus_behavior_id')->where('behavior_identification',$request['behavior_identification'])->first();
+            if ($virus_id){
+                $where[] = ['virus_behavior_id', $virus_id->virus_behavior_id];
             }
-            $where[] = ['virus_behavior_id', $request['virus_behavior_id']];
         }
 
         return $this->generalRecord