47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Entities\MyLogEntity as Entity;
|
|
use App\Models\MyLogModel as Model;
|
|
use App\Services\Auth\AuthService;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
use App\Libraries\LogCollector;
|
|
|
|
class MyLogService extends CommonService
|
|
{
|
|
public function __construct(IncomingRequest $request)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
final public function getClassName(): string
|
|
{
|
|
return "MyLog";
|
|
}
|
|
final public function getClassPath(): string
|
|
{
|
|
return $this->getClassName();
|
|
}
|
|
public function getModelClass(): string
|
|
{
|
|
return Model::class;
|
|
}
|
|
public function getEntityClass(): string
|
|
{
|
|
return Entity::class;
|
|
}
|
|
|
|
public function save($service, string $method, AuthService $myauth, string $title): Entity
|
|
{
|
|
$formDatas = [
|
|
'user_uid' => $myauth->getUIDByAuthInfo(),
|
|
'class_name' => $service->getClassName(),
|
|
'method_name' => $method,
|
|
'title' => $title,
|
|
'content' => LogCollector::dump(),
|
|
];
|
|
LogCollector::clear();
|
|
return $this->getModel()->create($formDatas, new Entity());
|
|
}
|
|
}
|