Commit 3635d0c1 authored by 王源's avatar 王源 🎧

修复生成验证bug

parent 84d84ec6
......@@ -485,7 +485,7 @@ class MakeModelCommand extends HyperfCommand
}
$rs = [];
$required = "nullable";
if ($null == 'YES') {
if ($null !== 'YES') {
if (!$default) {
$required = "required";
$messages[] = "\t\t'{$name}.{$required}' => '{$msgName}不能为空!'";
......@@ -518,8 +518,8 @@ class MakeModelCommand extends HyperfCommand
case "text":
$rs[] = 'string';
if ($length) {
$rs[] = 'size:' . $length;
$messages[] = "\t\t'{$name}.size' => '{$msgName}字符长度不能超过{$length}!'";
$rs[] = 'max:' . $length;
$messages[] = "\t\t'{$name}.max' => '{$msgName}字符长度不能超过{$length}!'";
}
break;
case "date":
......
......@@ -26,18 +26,18 @@ class %ModelClass%RepositoryEloquent extends BaseRepository implements %ModelCla
/**
* %ModelClass% 模型
* @return %ModelClass%|string
* @return mixed
*/
public function model(): %ModelClass%
public function model()
{
return %ModelClass%::class;
}
/**
* 数据校验器
* @return %ModelClass%Validator|string
* @return mixed
*/
public function validator(): %ModelClass%Validator
public function validator()
{
return %ModelClass%Validator::class;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment