62 lines
1.5 KiB
PHP
62 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Entities\MyLogEntity;
|
|
use App\Models\MyLogModel;
|
|
use App\Services\Auth\AuthService;
|
|
use App\Libraries\LogCollector;
|
|
|
|
class MyLogService extends CommonService
|
|
{
|
|
public function __construct(mixed $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
$this->addClassName('MyLog');
|
|
}
|
|
public function getModelClass(): MyLogModel
|
|
{
|
|
return new MyLogModel();
|
|
}
|
|
public function getEntityClass(): MyLogEntity
|
|
{
|
|
return new MyLogEntity();
|
|
}
|
|
|
|
public function getFormFields(): array
|
|
{
|
|
return [
|
|
"user_uid",
|
|
"class_name",
|
|
"method_name",
|
|
"title",
|
|
"content",
|
|
"status",
|
|
];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ['user_uid', 'status'];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return ['status'];
|
|
}
|
|
public function getIndexFields(): array
|
|
{
|
|
return ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at'];
|
|
}
|
|
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
|
|
{
|
|
$formDatas = [
|
|
'user_uid' => $myauth->getUIDByAuthInfo(),
|
|
'class_name' => $service->getClassName(),
|
|
'method_name' => $method,
|
|
'title' => $title,
|
|
'content' => LogCollector::dump(),
|
|
];
|
|
LogCollector::clear();
|
|
return $this->create($formDatas);
|
|
}
|
|
}
|