cfmgrv4/app/Controllers/Admin/MyLogController.php
2025-03-13 11:25:45 +09:00

54 lines
1.7 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();
$this->class_name = "MyLog";
$this->class_path = $this->class_name;
}
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;
}
}