40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Services\BoardService;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class BoardController extends AdminController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
|
$this->class_path .= $this->getService()->getClassName();
|
|
// $this->view_path = '/admin/search';
|
|
}
|
|
public function getService(): BoardService
|
|
{
|
|
if (!$this->_service) {
|
|
$this->_service = new BoardService();
|
|
}
|
|
return $this->_service;
|
|
}
|
|
|
|
public function latest(): ResponseInterface
|
|
{
|
|
$this->getService()->setAction(__FUNCTION__);
|
|
$this->getService()->setFormFields();
|
|
//전달값정의
|
|
$this->getService()->setFormDatas($this->request->getGet());
|
|
$formDatas = $this->getSErvice()->getFormDatas();
|
|
return $this->response->setJSON($this->getService()->latest(
|
|
['category' => array_key_exists('category', $formDatas) && $formDatas['category'] ? $formDatas['category'] : 'notice'],
|
|
array_key_exists('limit', $formDatas) ? $formDatas['limit'] : 3
|
|
));
|
|
}
|
|
}
|