<?php

namespace App\Controllers\Admin;

use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\UserService;
use App\Helpers\UserHelper;

class Home extends AdminController
{
    private $_service = null;
    public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
    {
        parent::initController($request, $response, $logger);
    }

    final public function getService(): UserService
    {
        if (!$this->_service) {
            $this->_service = new UserService($this->request);
        }
        return $this->_service;
    }
    public function getHelper(): mixed
    {
        if (!$this->_helper) {
            $this->_helper = new UserHelper($this->request);
        }
        return $this->_helper;
    }

    //Index,FieldForm관련
    public function index(): string
    {
        helper(['form']);
        return view('admin/welcome_message', ['viewDatas' => $this->getViewDatas()]);
    }
}
