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); }