diff --git a/src/template/impl/ValidateAutoMake.php b/src/template/impl/ValidateAutoMake.php index 88c83fe..e23ce4e 100644 --- a/src/template/impl/ValidateAutoMake.php +++ b/src/template/impl/ValidateAutoMake.php @@ -34,6 +34,7 @@ public function make($table, $path, $other) $model = ucfirst(Utils::camelize($table)); $filePath = empty($path) ? '' : DS . $path; + $namespace = empty($path) ? '\\' : '\\' . $path . '\\'; $prefix = config('database.connections.mysql.prefix'); $column = Db::query('SHOW FULL COLUMNS FROM `' . $prefix . $table . '`'); @@ -47,6 +48,7 @@ public function make($table, $path, $other) $ruleArr = VarExporter::export($rule); $attributesArr = VarExporter::export($attributes); + $tplContent = str_replace('', $namespace, $tplContent); $tplContent = str_replace('', $model, $tplContent); $tplContent = str_replace('', '' . $ruleArr, $tplContent); $tplContent = str_replace('', $attributesArr, $tplContent); diff --git a/src/tpl/validate.tpl b/src/tpl/validate.tpl index 492112e..84677e1 100644 --- a/src/tpl/validate.tpl +++ b/src/tpl/validate.tpl @@ -1,6 +1,6 @@ validate; use nickbai\tp6curd\extend\ExtendValidate;