Automation init...4

This commit is contained in:
최준흠 2024-09-22 23:37:39 +09:00
parent 387c3bff27
commit 67e107d271
4 changed files with 10 additions and 7 deletions

View File

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

View File

@ -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

View File

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

View File

@ -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;