From fdab7f4307de06bbdccfc890ca3fac5d2b52c4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Fri, 6 Sep 2024 20:46:03 +0900 Subject: [PATCH] Automation init...1 --- app/Models/CommonModel.php | 2 +- app/Models/Mangboard/BoardModel.php | 1 + app/Models/Mangboard/UserModel.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 23f8fd5..6e729ee 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -49,7 +49,6 @@ abstract class CommonModel extends Model { parent::__construct(); $this->setFields($fields); - $this->setRules($this->getFields()); } abstract public function getTitleField(): string; @@ -69,6 +68,7 @@ abstract class CommonModel extends Model final public function setFields(array $fields): void { $this->allowedFields = $fields; + $this->setRules($this->allowedFields); } final public function getRules(array $options): array //options=>except or only { diff --git a/app/Models/Mangboard/BoardModel.php b/app/Models/Mangboard/BoardModel.php index d79e123..7aaffa1 100644 --- a/app/Models/Mangboard/BoardModel.php +++ b/app/Models/Mangboard/BoardModel.php @@ -58,6 +58,7 @@ abstract class BoardModel extends CommonModel $entity = $this->create_process($entity); //GID값이 PK랑 같은 값 전달 후 Entity 수정 $entity->gid = $entity->getPK(); + $this->setFields(["gid"]); return $this->modify_process($entity); } diff --git a/app/Models/Mangboard/UserModel.php b/app/Models/Mangboard/UserModel.php index 63586ca..6eb779c 100644 --- a/app/Models/Mangboard/UserModel.php +++ b/app/Models/Mangboard/UserModel.php @@ -61,6 +61,7 @@ class UserModel extends CommonModel $entity = $this->create_process($entity); //GID값이 PK랑 같은 값 전달 후 Entity 수정 $entity->gid = $entity->getPK(); + $this->setFields(["gid"]); return $this->modify_process($entity); }