dbmsv2/app/Cells/Equipment/ServerPartCell.php
2025-09-11 15:54:56 +09:00

42 lines
1.2 KiB
PHP

<?php
namespace App\Cells\Equipment;
use App\Services\Equipment\ServerPartService;
class ServerPartCell extends EquipmentCell
{
public function __construct()
{
parent::__construct(new ServerPartService());
}
public function parttable(array $params): string
{
$this->getService()->setAction(__FUNCTION__);
$this->getService()->setFormFields();
$this->getService()->setFormFilters();
$this->getService()->setFormRules();
$this->getService()->setFormOptions();
$serverPartEntities = $this->getService()->getEntities(['serverinfo_uid' => $params['serverinfo_uid']]);
$entities = [];
foreach ($serverPartEntities as $entity) {
if (!array_key_exists($entity->getType(), $entities)) {
$entities[$entity->getType()] = [];
}
$entities[$entity->getType()][] = $entity;
}
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
return view('cells/serverpart/' . $template, [
'serverPartCellDatas' => [
'control' => $this->getService()->getControlDatas(),
'service' => $this->getService(),
'entities' => $entities,
'serverinfo_uid' => $params['serverinfo_uid'],
'types' => $params['types'],
]
]);
}
}