58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Cloudflare;
|
|
|
|
use App\Controllers\MVController;
|
|
use App\Libraries\MyCloudflare\Account;
|
|
use Psr\Log\LoggerInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
|
|
use App\Traits\AuthTrait;
|
|
use App\Models\Cloudflare\AccountModel;
|
|
use App\Entities\Cloudflare\AccountEntity;
|
|
use App\Libraries\MySocket\CloudflareSocket;
|
|
|
|
|
|
class AccountController extends MVController
|
|
{
|
|
use AuthTrait;
|
|
private $_model = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->session = $this->session_AuthTrait();
|
|
$this->class_name = 'Account';
|
|
helper($this->class_name);
|
|
}
|
|
|
|
final protected function getModel(): AccountModel
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new AccountModel();
|
|
}
|
|
return $this->_model;
|
|
}
|
|
protected function create_init(): void
|
|
{
|
|
$this->fields = ['id', 'apikey'];
|
|
$this->filter_fields = ['status'];
|
|
$this->action = DB_ACTION["CREATE"];
|
|
$this->getModel()->setAction($this->action);
|
|
}
|
|
public function create_form(): RedirectResponse|string
|
|
{
|
|
return $this->create_form_process();
|
|
}
|
|
protected function create_process_submit(): AccountEntity
|
|
{
|
|
$account = new Account();
|
|
return $account->create($this->formDatas);
|
|
}
|
|
public function create(): RedirectResponse
|
|
{
|
|
return parent::create_process();
|
|
}
|
|
}
|