generalRecord = $generalRecord; $this->behavior = $behavior; } public function lists($request) { $perPage = isset($request['per_page']) ? $request['per_page'] : 20; $where = []; if(isset($request['id'])){ $where[] = ['id', $request['id']]; } if(isset($request['uid'])){ $where[] = ['uid', $request['uid']]; } if(isset($request['trigger_type'])){ $where[] = ['trigger_type', $request['trigger_type']]; } if(isset($request['virus_behavior_id'])){ $where[] = ['virus_behavior_id', $request['virus_behavior_id']]; } if(isset($request['content_author_id'])){ $where[] = ['content_author_id', $request['content_author_id']]; } if(isset($request['related_content_id'])){ $where[] = ['related_content_id', $request['related_content_id']]; } if(isset($request['behavior_identification'])){ $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]; } } return $this->generalRecord ->where($where) ->where(function($query) use ($request){ if(isset($request['created_at'])){ $time = explode('_', $request['created_at']); $query->whereBetween('created_at', $time); } }) ->orderBy('id','desc') ->paginate($perPage); } }