mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
生成crud增加数据验证
This commit is contained in:
parent
2402d0f796
commit
95f361def9
@ -536,6 +536,7 @@ class SystemCrudServices extends BaseServices
|
||||
$controller = app()->make(Controller::class);
|
||||
$controller->setFilePathName($filePath['controller'] ?? '')->setbasePath($basePath)->handle($tableName, [
|
||||
'usePath' => $service->getUsePath(),
|
||||
'validateName' => '\\' . $validate->getUsePath() . '::class',
|
||||
'field' => array_column($options['fromField'], 'field'),
|
||||
]);
|
||||
//生成路由
|
||||
|
||||
@ -53,8 +53,8 @@ class Controller extends Make
|
||||
{
|
||||
$path = $options['path'] ?? '';
|
||||
$contentPhp = '';
|
||||
$var = ["{%date%}"];
|
||||
$fieldPhp = [$this->value['date']];
|
||||
$var = ["{%date%}", '{%validateName%}'];
|
||||
$fieldPhp = [$this->value['date'], $options['validateName'] ?? ''];
|
||||
|
||||
$action = $options['action'] ?? [];
|
||||
$field = $options['field'] ?? [];
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
{%field-php%}
|
||||
]);
|
||||
|
||||
validate({%validateName%})->check($data);
|
||||
|
||||
$this->service->crudSave($data);
|
||||
|
||||
return app('json')->success(100021);
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
{%field-php%}
|
||||
]);
|
||||
|
||||
validate({%validateName%})->check($data);
|
||||
|
||||
$this->service->crudUpdate((int)$id, $data);
|
||||
|
||||
return app('json')->success(100001);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user