42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Entities\MyLogEntity;
|
|
|
|
class MyLogModel extends CommonModel
|
|
{
|
|
const TABLE = "user_history";
|
|
const PK = "uid";
|
|
const TITLE = "title";
|
|
protected $table = self::TABLE;
|
|
protected $primaryKey = self::PK;
|
|
protected $returnType = MyLogEntity::class;
|
|
protected $allowedFields = [
|
|
"user_uid",
|
|
"title",
|
|
"content",
|
|
"status",
|
|
"updated_at"
|
|
];
|
|
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 "user_uid":
|
|
$rule = "if_exist|numeric";
|
|
break;
|
|
default:
|
|
$rule = parent::getFormFieldRule($action, $field);
|
|
break;
|
|
}
|
|
return $rule;
|
|
}
|
|
}
|