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

修复生成验证bug

parent 84d84ec6
...@@ -485,7 +485,7 @@ class MakeModelCommand extends HyperfCommand ...@@ -485,7 +485,7 @@ class MakeModelCommand extends HyperfCommand
} }
$rs = []; $rs = [];
$required = "nullable"; $required = "nullable";
if ($null == 'YES') { if ($null !== 'YES') {
if (!$default) { if (!$default) {
$required = "required"; $required = "required";
$messages[] = "\t\t'{$name}.{$required}' => '{$msgName}不能为空!'"; $messages[] = "\t\t'{$name}.{$required}' => '{$msgName}不能为空!'";
...@@ -518,8 +518,8 @@ class MakeModelCommand extends HyperfCommand ...@@ -518,8 +518,8 @@ class MakeModelCommand extends HyperfCommand
case "text": case "text":
$rs[] = 'string'; $rs[] = 'string';
if ($length) { if ($length) {
$rs[] = 'size:' . $length; $rs[] = 'max:' . $length;
$messages[] = "\t\t'{$name}.size' => '{$msgName}字符长度不能超过{$length}!'"; $messages[] = "\t\t'{$name}.max' => '{$msgName}字符长度不能超过{$length}!'";
} }
break; break;
case "date": case "date":
......
...@@ -26,18 +26,18 @@ class %ModelClass%RepositoryEloquent extends BaseRepository implements %ModelCla ...@@ -26,18 +26,18 @@ class %ModelClass%RepositoryEloquent extends BaseRepository implements %ModelCla
/** /**
* %ModelClass% 模型 * %ModelClass% 模型
* @return %ModelClass%|string * @return mixed
*/ */
public function model(): %ModelClass% public function model()
{ {
return %ModelClass%::class; return %ModelClass%::class;
} }
/** /**
* 数据校验器 * 数据校验器
* @return %ModelClass%Validator|string * @return mixed
*/ */
public function validator(): %ModelClass%Validator public function validator()
{ {
return %ModelClass%Validator::class; 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