'if_exist|min_length[10]|max_length[200]', 'account_uid' => 'if_exist|min_length[10]|max_length[200]', 'domain' => 'if_exist|string', 'name_servers' => 'if_exist|string', 'plan' => 'if_exist|string', 'development_mode' => 'if_exist|in_list[on,off]', 'ipv6' => 'if_exist|in_list[on,off]', 'security_level' => 'if_exist|string', 'status' => 'if_exist|string', 'updated_at' => 'if_exist|valid_date', 'created_at' => 'if_exist|valid_date', ]; // 'security_level' => 'if_exist|in_list[essentially_off,low,medium,under_attack]', // 'status' => 'if_exist|in_list[active,pending]', protected $validationMessages = []; protected $skipValidation = true; protected $cleanValidationRules = true; // Callbacks protected $allowCallbacks = true; protected $beforeInsert = []; protected $afterInsert = []; protected $beforeUpdate = []; protected $afterUpdate = []; protected $beforeFind = []; protected $afterFind = []; protected $beforeDelete = []; protected $afterDelete = []; public function getTableName() { return $this->table; } public function getEntity(string $uid): null|ZoneEntity { $entity = $this->asObject(ZoneEntity::class)->where('uid', $uid)->first(); if (is_null($entity)) { throw new \Exception(__METHOD__ . "에서 {$uid} 해당 정보가 없습니다."); } return $entity; } //Index 검색용 public function setIndexWordFilter(string $word) { $this->like('domain', $word, 'both'); //befor , after , both if (isIPAddress_CommonHelper($word)) { $ids = $this->db->table('cloudflarerecord')->select('zone_uid')->where('content', $word, 'both')->get()->getResultArray(); echo var_export($ids, true); exit; $this->wherein('uid', $ids); } } 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}"); } //도메인이 이미 존재하는지 체크 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; } }