cfmgrv4 init...3
This commit is contained in:
parent
4d06ed3df3
commit
b19763fa96
@ -72,7 +72,7 @@ class FirewallController extends CloudflareController
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, 'mode', 'description', 'expression', 'ref', 'paused', 'updated_at', 'created_at'];
|
||||
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, 'action', 'description', 'expression', 'ref', 'paused', 'updated_at', 'created_at'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = [$this->getModel()::PARENT, 'mode', 'paused'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
@ -81,7 +81,7 @@ class FirewallController extends CloudflareController
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
{
|
||||
$this->init('create', [$this->getModel()::PARENT, 'mode', 'description', 'expression', 'paused']);
|
||||
$this->init('create', [$this->getModel()::PARENT, 'action', 'description', 'expression', 'paused']);
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
//부모데이터 정의
|
||||
$parent_field = $this->getModel()::PARENT;
|
||||
@ -111,14 +111,14 @@ class FirewallController extends CloudflareController
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'mode', 'description', 'expression', 'paused']);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'action', 'description', 'expression', 'paused']);
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
public function modify_form(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init('modify', [$this->getModel()::PARENT, 'mode', 'description', 'expression', 'paused']);
|
||||
$this->init('modify', [$this->getModel()::PARENT, 'action', 'description', 'expression', 'paused']);
|
||||
return $this->modify_form_procedure($uid);
|
||||
}
|
||||
protected function modify_process(mixed $uid): void
|
||||
@ -138,7 +138,7 @@ class FirewallController extends CloudflareController
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'mode', 'description', 'expression', 'paused']);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'action', 'description', 'expression', 'paused']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
|
||||
@ -43,7 +43,7 @@ class FirewallHelper extends MVCHelper
|
||||
case 'expression':
|
||||
$form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", ...$extras]);
|
||||
break;
|
||||
case "mode":
|
||||
case "action":
|
||||
case "paused":
|
||||
$form = form_dropdown($field, [
|
||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||
|
||||
@ -5,7 +5,7 @@ return [
|
||||
'uid' => "번호",
|
||||
'zone_uid' => "도메인",
|
||||
'description' => "설명",
|
||||
'mode' => "Mode",
|
||||
'action' => "Action",
|
||||
'expression' => "Rule",
|
||||
'ref' => "REF",
|
||||
'paused' => "상태",
|
||||
@ -13,7 +13,7 @@ return [
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"ZONE_UID" => [],
|
||||
"MODE" => [
|
||||
"ACTION" => [
|
||||
'simulate' => 'simulate',
|
||||
'ban' => 'ban',
|
||||
'challenge' => 'challenge',
|
||||
|
||||
@ -16,7 +16,7 @@ class FirewallModel extends CommonModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $useAutoIncrement = false;
|
||||
protected $returnType = FirewallEntity::class; //object,array,entity명::class
|
||||
protected $allowedFields = [self::PK, self::PARENT, self::TITLE, 'mode', 'description', 'expression', 'paused', 'updated_at', 'crated_at'];
|
||||
protected $allowedFields = [self::PK, self::PARENT, self::TITLE, 'action', 'description', 'expression', 'paused', 'updated_at', 'crated_at'];
|
||||
protected $useTimestamps = true;
|
||||
|
||||
public function __construct()
|
||||
@ -38,6 +38,7 @@ class FirewallModel extends CommonModel
|
||||
$rule = "required|trim|alpha_numeric";
|
||||
break;
|
||||
case self::TITLE:
|
||||
case "action":
|
||||
case "expression":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
@ -92,6 +93,6 @@ class FirewallModel extends CommonModel
|
||||
public function setList_WordFilter(string $word, $field = null): void
|
||||
{
|
||||
parent::setList_WordFilter($word, $field);
|
||||
$this->orLike(self::TABLE . '.mode', $word, 'both');
|
||||
$this->orLike(self::TABLE . '.' . self::TITLE, $word, 'both');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user