63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Entities\MyLogEntity;
|
|
use App\Helpers\MyLogHelper;
|
|
use App\Models\MyLogModel;
|
|
use App\Services\CommonService;
|
|
|
|
class MyLogService extends CommonService
|
|
{
|
|
private $_myAuth = null;
|
|
private $_myAuthUID = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct(new MyLogModel(), new MyLogHelper());
|
|
$this->addClassName('MyLog');
|
|
if ($this->getMyAuth()->isLoggedIn()) {
|
|
$this->_myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
|
|
}
|
|
}
|
|
final public function getMyAuth(): mixed
|
|
{
|
|
if (!$this->_myAuth) {
|
|
$this->_myAuth = service('myauth');
|
|
}
|
|
return $this->_myAuth;
|
|
}
|
|
public function getFormFields(): array
|
|
{
|
|
return [
|
|
"title",
|
|
"content",
|
|
"status",
|
|
];
|
|
}
|
|
public function getFormFilters(): array
|
|
{
|
|
return [
|
|
'user_uid',
|
|
'status'
|
|
];
|
|
}
|
|
public function getBatchjobFields(): array
|
|
{
|
|
return ['status'];
|
|
}
|
|
//기본 기능부분
|
|
//FieldForm관련용
|
|
//List 검색용
|
|
public function index_condition_filterWord(string $word): void
|
|
{
|
|
$this->getModel()->orLike($this->getModel()::TABLE . "." . $this->getModel()::TITLE, $word, 'both');
|
|
$this->getModel()->orLike($this->getModel()::TABLE . '.content', $word, 'both');
|
|
}
|
|
public function create(array $formDatas): MyLogEntity
|
|
{
|
|
//관리자(작업자정보) 등록
|
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
return parent::create($formDatas);
|
|
}
|
|
}
|