dbmsv2/app/Models/Equipment/SwitchModel.php
2025-08-20 17:27:59 +09:00

43 lines
1.1 KiB
PHP

<?php
namespace App\Models\Equipment;
use App\Entities\Equipment\SwitchEntity;
class SwitchModel extends EquipmentModel
{
const TABLE = "switchinfo";
const PK = "uid";
const TITLE = "code";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
// protected $useAutoIncrement = false;
protected $returnType = SwitchEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"serviceinfo_uid",
"serverinfo_uid",
"code",
"status",
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}