65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment;
|
|
|
|
use App\Entities\Equipment\ServerEntity;
|
|
use App\Models\Equipment\ServerModel;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
use App\Services\Equipment\EquipmentService;
|
|
|
|
class ServerService extends EquipmentService
|
|
{
|
|
protected ?IncomingRequest $request = null;
|
|
public function __construct(?IncomingRequest $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
public function getClassName(): string
|
|
{
|
|
return parent::getClassName() . DIRECTORY_SEPARATOR . "Server";
|
|
}
|
|
public function getModelClass(): ServerModel
|
|
{
|
|
return new ServerModel();
|
|
}
|
|
public function getEntityClass(): ServerEntity
|
|
{
|
|
return new ServerEntity();
|
|
}
|
|
public function getFields(): array
|
|
{
|
|
return [
|
|
"code",
|
|
"type",
|
|
"model",
|
|
"manufactur_at",
|
|
"status",
|
|
"description",
|
|
];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ["type", 'status'];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return ["type", 'status'];
|
|
}
|
|
|
|
public function getFormFieldOption(string $field, array $options = []): array
|
|
{
|
|
switch ($field) {
|
|
case 'SERVER':
|
|
foreach ($this->getEntities() as $entity) {
|
|
$options[$entity->getPK()] = $entity->getTitle();
|
|
}
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
// dd($options);
|
|
return $options;
|
|
}
|
|
}
|