where($this->getPKField(), $uid); return $this->getEntity(); } public function getEntityByID(string $id): null | ZoneEntity { $this->where($this->getTitleField(), $id); return $this->getEntity(); } //create용 public function create(array $formDatas = []): ZoneEntity { return $this->create_process(new ZoneEntity(), $formDatas); } //modify용 public function modify(ZoneEntity $entity, array $formDatas): ZoneEntity { return $this->modify_process($entity, $formDatas); } //도메인이 이미 존재하는지 체크 public function isUniqueDomain(string $account_uid, string $domain): bool { $this->where('account_uid', $account_uid); $this->where('domain', $domain); return is_null($this->first()) ? true : false; } //Index 검색용 public function setIndexWordFilter(string $word) { $subquery = $this->db->table('cloudflarerecord')->select('zone_uid')->like('content', $word, 'both'); $this->like('domain', $word, 'both'); //befor , after , both $this->orWhereIn('uid', $subquery); } public function setIndexDateFilter($start, $end) { $this->where('created_at >=', $start); $this->where('created_at <=', $end); } public function setIndexOrderBy($field, $order = 'ASC') { $this->orderBy("domain ASC, {$field} {$order}"); } }