cfmgrv4/app/Controllers/Admin/Cloudflare/AuthController.php
2025-03-12 12:51:37 +09:00

80 lines
2.5 KiB
PHP

<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Helpers\Cloudflare\AuthHelper;
use App\Services\Cloudflare\AuthService;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AuthController 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 AuthHelper();
}
protected function getService(): AuthService
{
if ($this->service === null) {
$this->service = new AuthService();
}
return $this->service;
}
//생성
public function create_form(): RedirectResponse|string
{
$this->init('create', [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
return $this->create_form_procedure();
}
public function create(): RedirectResponse|string
{
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
return $this->create_procedure();
}
//수정
public function modify_form(int $uid): RedirectResponse|string
{
$this->init('modify', [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
return $this->modify_form_procedure($uid);
}
public function modify(int $uid): RedirectResponse|string
{
$this->init(__FUNCTION__, [$this->getService()->getModel()::TITLE, 'authkey', 'status']);
return $this->modify_procedure($uid);
}
//단일필드작업
public function toggle(mixed $uid, string $field): RedirectResponse
{
return $this->toggle_procedure($uid, $field);
}
//일괄처리작업
public function batchjob(): RedirectResponse
{
$this->init(__FUNCTION__);
return $this->batchjob_procedure();
}
//View
public function view(int $uid): RedirectResponse|string
{
$this->init(__FUNCTION__);
return $this->view_procedure($uid);
}
// 리스트
public function index(): string
{
$this->init(__FUNCTION__);
return $this->list_procedure();
}
// Download
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
{
$this->init(__FUNCTION__);
return $this->download_procedure($output_type, $uid);
}
}