35 lines
902 B
PHP
35 lines
902 B
PHP
<?php
|
|
|
|
namespace App\Models\Equipment\Link;
|
|
|
|
use App\Models\Equipment\EquipmentModel;
|
|
|
|
abstract class LinkModel extends EquipmentModel
|
|
{
|
|
// protected $returnType = CpuEntity::class;
|
|
protected $allowedFields = [
|
|
"serverinfo_uid",
|
|
"cpuinfo_uid",
|
|
];
|
|
protected 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 "serverinfo_uid":
|
|
case "cpuinfo_uid":
|
|
$rule = "required|trim|string";
|
|
break;
|
|
default:
|
|
$rule = parent::getFieldRule($action, $field);
|
|
break;
|
|
}
|
|
return $rule;
|
|
}
|
|
}
|