58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Controllers\MVController;
|
|
use Psr\Log\LoggerInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
|
|
use App\Libraries\MyMangboard\User;
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use App\Models\Mangboard\UserModel;
|
|
use App\Entities\Mangboard\UserEntity;
|
|
|
|
use App\Traits\AuthTrait;
|
|
|
|
class UserController extends MVController
|
|
{
|
|
use AuthTrait;
|
|
private $_model = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->class_name = "Admin/User";
|
|
$this->layout = LAYOUTS['admin'];
|
|
$this->title = lang("{$this->class_name}.title");
|
|
$this->session = $this->session_AuthTrait();
|
|
helper($this->class_name);
|
|
}
|
|
protected function getModel(): UserModel
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new UserModel();
|
|
}
|
|
return $this->_model;
|
|
}
|
|
protected function create_init(): void
|
|
{
|
|
// $this->fields = [$this->getModel()::TITLE, 'apikey', 'status'];
|
|
$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(): UserEntity
|
|
{
|
|
$user = new User();
|
|
return $user->create($this->formDatas);
|
|
}
|
|
public function create(): RedirectResponse
|
|
{
|
|
return parent::create_process();
|
|
}
|
|
}
|