43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Equipment;
|
|
|
|
use App\Entities\Equipment\SoftwareEntity;
|
|
|
|
class SoftwareModel extends EquipmentModel
|
|
{
|
|
const TABLE = "softwareinfo";
|
|
const PK = "uid";
|
|
const TITLE = "model";
|
|
protected $table = self::TABLE;
|
|
protected $primaryKey = self::PK;
|
|
protected $returnType = SoftwareEntity::class;
|
|
protected $allowedFields = [
|
|
"type",
|
|
"model",
|
|
"status",
|
|
"description",
|
|
"updated_at"
|
|
];
|
|
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 "model":
|
|
case "type":
|
|
$rule = "required|trim|string";
|
|
break;
|
|
default:
|
|
$rule = parent::getFieldRule($action, $field);
|
|
break;
|
|
}
|
|
return $rule;
|
|
}
|
|
}
|