From 67e107d271903a3b180e1181f22fae0aa26756a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Sun, 22 Sep 2024 23:37:39 +0900 Subject: [PATCH] Automation init...4 --- app/Config/Routes.php | 6 +++--- app/Controllers/Cloudflare/AccountController.php | 2 +- app/Controllers/MVController.php | 4 ++-- app/Models/Cloudflare/AccountModel.php | 5 ++++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 58f1334..b458a29 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -15,7 +15,7 @@ $routes->get('/', 'Home::index'); $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) { $routes->get('/', 'Home::index'); $routes->group('user', function ($routes) { - $routes->get('', 'UserController::index'); + $routes->get('/', 'UserController::index'); }); }); $routes->group('mangboard', ['namespace' => 'App\Controllers\Mangboard'], function ($routes) { @@ -35,10 +35,10 @@ $routes->group('mangboard', ['namespace' => 'App\Controllers\Mangboard'], functi $routes->group('cloudflare', ['namespace' => 'App\Controllers\Cloudflare'], function ($routes) { $routes->group('account', function ($routes) { $routes->get('/', 'AccountController::index'); - $routes->get('/create', 'AccountController::create_form'); + $routes->get('create', 'AccountController::create_form'); }); $routes->group('zone', function ($routes) { $routes->get('/', 'ZoneController::index'); - $routes->get('/create', 'ZoneController::create_form'); + $routes->get('create', 'ZoneController::create_form'); }); }); diff --git a/app/Controllers/Cloudflare/AccountController.php b/app/Controllers/Cloudflare/AccountController.php index 8ed7479..af44095 100644 --- a/app/Controllers/Cloudflare/AccountController.php +++ b/app/Controllers/Cloudflare/AccountController.php @@ -22,7 +22,7 @@ class AccountController extends MVController parent::initController($request, $response, $logger); $this->session = $this->session_AuthTrait(); $this->class_name = 'Account'; - $this->view_path = 'Account'; + $this->view_path = 'cloudflare'; helper($this->class_name); } final protected function getModel(): AccountModel diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php index e61218e..8d82918 100644 --- a/app/Controllers/MVController.php +++ b/app/Controllers/MVController.php @@ -32,7 +32,7 @@ abstract class MVController extends CommonController } return $options; } - protected function getFormFieldInput(string $field, mixed $value, array $inputs = []): array + protected function getFormFieldInput(string $field, string $value, array $inputs = []): array { switch ($field) { case 'status': @@ -58,7 +58,7 @@ abstract class MVController extends CommonController if (is_array($field)) { throw new \Exception(__FUNCTION__ . "에서 field array 입니다.\n" . var_export($field, true)); } - $inputs = $this->getFormFieldInput($field, old($field), $inputs); + $inputs = $this->getFormFieldInput($field, old($field) ?? DEFAULTS['EMPTY'], $inputs); } return $inputs; } diff --git a/app/Models/Cloudflare/AccountModel.php b/app/Models/Cloudflare/AccountModel.php index dfb8783..e38d3a0 100644 --- a/app/Models/Cloudflare/AccountModel.php +++ b/app/Models/Cloudflare/AccountModel.php @@ -7,7 +7,6 @@ use App\Models\CommonModel; class AccountModel extends CommonModel { - const TABLE = "cloudflarerecord"; const PK = "uid"; const TITLE = "id"; @@ -17,6 +16,10 @@ class AccountModel extends CommonModel protected $returnType = AccountEntity::class; //object,array,entity명::class protected $allowedFields = [self::PK, self::TITLE, 'apikey', 'oldkey', 'type', 'status', 'updated_at', 'created_at']; protected $useTimestamps = true; + public function __construct() + { + parent::__construct(); + } public function getTitleField(): string { return self::TITLE;