55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Cloudflare;
|
|
|
|
use App\Helpers\Cloudflare\AccountHelper;
|
|
use App\Services\Cloudflare\AccountService;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class AccountController extends CloudflareController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
|
$this->helper = new AccountHelper();
|
|
}
|
|
protected function getService(): AccountService
|
|
{
|
|
if ($this->service === null) {
|
|
$this->service = new AccountService();
|
|
$this->class_name = $this->service->getClassName();
|
|
$this->class_path = $this->service->getClassPath();
|
|
}
|
|
return $this->service;
|
|
}
|
|
protected function getFormFieldOption(string $field, array $options = []): array
|
|
{
|
|
switch ($field) {
|
|
case $this->getService()->getModel()::PARENT:
|
|
// $this->getAuthModel()->where('status', DEFAULTS['STATUS']);
|
|
$options[$field] = $this->getAuthModel()->getFormFieldOption($field);
|
|
// echo $this->getAuthModel()->getLastQuery();
|
|
// dd($options);
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
|
|
//reload Account By Auth
|
|
protected function reload_process(mixed $uid): void
|
|
{
|
|
//부모데이터정의
|
|
$this->auth_entity = $this->getAuthModel()->getEntityByPK($uid);
|
|
if ($this->auth_entity === null) {
|
|
throw new \Exception("Auth: [{$uid}] 정보를 찾을수 없습니다.");
|
|
}
|
|
$this->getService()->reload($this->auth_entity);
|
|
}
|
|
}
|