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

64 lines
2.0 KiB
PHP

<?php
namespace App\Controllers\Admin;
use App\Helpers\MyLogHelper;
use App\Services\MyLogService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Models\UserModel;
class MyLogController extends AdminController
{
private $_userModel = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->title = lang("Mylog.title");
$this->helper = new MyLogHelper();
}
protected function getService(): MyLogService
{
if ($this->service === null) {
$this->service = new MyLogService();
}
return $this->service;
}
public function getUserModel(): UserModel
{
if ($this->_userModel === null) {
$this->_userModel = new UserModel();
}
return $this->_userModel;
}
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'user_uid':
// $this->getUserModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getUserModel()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
//View
public function view(int $uid): RedirectResponse|string
{
$this->init(__FUNCTION__, ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'created_at', 'content']);
return $this->view_procedure($uid);
}
// 리스트
public function index(): string
{
$this->init(__FUNCTION__);
return $this->list_procedure();
}
}