60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment;
|
|
|
|
use App\Entities\Equipment\IpEntity;
|
|
use App\Models\Equipment\IpModel;
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
|
|
class IpService extends EquipmentService
|
|
{
|
|
protected ?IncomingRequest $request = null;
|
|
public function __construct(?IncomingRequest $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
public function getClassName(): string
|
|
{
|
|
return parent::getClassName() . DIRECTORY_SEPARATOR . "Ip";
|
|
}
|
|
public function getModelClass(): IpModel
|
|
{
|
|
return new IpModel();
|
|
}
|
|
public function getEntityClass(): IpEntity
|
|
{
|
|
return new IpEntity();
|
|
}
|
|
public function getFields(): array
|
|
{
|
|
return [
|
|
"lineinfo_uid",
|
|
"ip",
|
|
"status",
|
|
];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ["lineinfo_uid", 'status'];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return ['status'];
|
|
}
|
|
public function getFormFieldOption(string $field, array $options = []): array
|
|
{
|
|
switch ($field) {
|
|
case 'IP':
|
|
foreach ($this->getEntities(['status' => 'use']) as $entity) {
|
|
$options[$entity->getPK()] = $entity->getTitle();
|
|
}
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
// dd($options);
|
|
return $options;
|
|
}
|
|
}
|