dbms/app/Models/Customer/ServiceServerModel.php
2025-05-20 18:50:49 +09:00

46 lines
1.2 KiB
PHP

<?php
namespace App\Models\Customer;
use App\Entities\Customer\ServiceServerEntity;
class ServiceServerModel extends CustomerModel
{
const TABLE = "serviceinfos_partinfos";
const PK = "uid";
const TITLE = "uid";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServiceServerEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"partinfo_uid",
"billing_type",
"amount",
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "serviceinfo_uid":
case "partinfo_uid":
case "amount":
$rule = "required|numeric";
break;
case "billing_type":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
}