48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Equipment;
|
|
|
|
use App\Entities\Equipment\LineEntity;
|
|
|
|
class LineModel extends EquipmentModel
|
|
{
|
|
const TABLE = "lineinfo";
|
|
const PK = "uid";
|
|
const TITLE = "title";
|
|
protected $table = self::TABLE;
|
|
protected $primaryKey = self::PK;
|
|
protected $returnType = LineEntity::class;
|
|
protected $allowedFields = [
|
|
"type",
|
|
"title",
|
|
"bandwith",
|
|
"start_at",
|
|
"end_at",
|
|
"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 "bandwith":
|
|
case "type":
|
|
$rule = "required|trim|string";
|
|
break;
|
|
case "start_at":
|
|
case "end_at":
|
|
$rule = "permit_empty|valid_date";
|
|
break;
|
|
default:
|
|
$rule = parent::getFormFieldRule($action, $field);
|
|
break;
|
|
}
|
|
return $rule;
|
|
}
|
|
}
|