diff --git a/src/plugin/admin/app/common/LayuiForm.php b/src/plugin/admin/app/common/Layui.php similarity index 99% rename from src/plugin/admin/app/common/LayuiForm.php rename to src/plugin/admin/app/common/Layui.php index 20fc665..5f6fb4f 100644 --- a/src/plugin/admin/app/common/LayuiForm.php +++ b/src/plugin/admin/app/common/Layui.php @@ -3,7 +3,7 @@ namespace plugin\admin\app\common; use support\exception\BusinessException; -class LayuiForm +class Layui { /** @@ -681,16 +681,16 @@ EOF; * 构建表单 * @param $table * @param string $type - * @return LayuiForm + * @return Layui * @throws BusinessException */ - static public function buildForm($table, string $type = 'insert'): LayuiForm + static public function buildForm($table, string $type = 'insert'): Layui { if (!in_array($type, ['insert', 'update', 'search'])) { $type = 'insert'; } $filter = $type === 'search' ? 'searchable' : 'form_show'; - $form = new LayuiForm(); + $form = new Layui(); $schema = Util::getSchema($table); $forms = $schema['forms']; $columns = $schema['columns']; diff --git a/src/plugin/admin/app/controller/TableController.php b/src/plugin/admin/app/controller/TableController.php index 528af27..ebb3b41 100644 --- a/src/plugin/admin/app/controller/TableController.php +++ b/src/plugin/admin/app/controller/TableController.php @@ -4,7 +4,7 @@ namespace plugin\admin\app\controller; use Doctrine\Inflector\InflectorFactory; use Illuminate\Database\Schema\Blueprint; -use plugin\admin\app\common\LayuiForm; +use plugin\admin\app\common\Layui; use plugin\admin\app\common\Util; use plugin\admin\app\model\Role; use plugin\admin\app\model\Rule; @@ -40,7 +40,7 @@ class TableController extends Base { $table = $request->get('table'); $table = Util::filterAlphaNum($table); - $form = LayuiForm::buildForm($table, 'search'); + $form = Layui::buildForm($table, 'search'); $table_info = Util::getSchema($table, 'table'); $primary_key = $table_info['primary_key'][0] ?? null; return view("table/view", [ @@ -704,7 +704,7 @@ EOF; $this->mkdir($template_file_path . '/index.html'); $code_base = Util::controllerToUrlPath($controller_class_with_namespace); $code_base = str_replace('/', '.', trim($code_base, '/')); - $form = LayuiForm::buildForm($table, 'search'); + $form = Layui::buildForm($table, 'search'); $html = $form->html(3); $html = $html ? << @@ -731,7 +731,7 @@ EOF : ''; $html = str_replace("\n", "\n" . str_repeat(' ', 2), $html); $js = $form->js(3); - $table_js = LayuiForm::buildTable($table, 4); + $table_js = Layui::buildTable($table, 4); $template_content = << @@ -919,7 +919,7 @@ EOF EOF; file_put_contents("$template_file_path/index.html", $template_content); - $form = LayuiForm::buildForm($table); + $form = Layui::buildForm($table); $html = $form->html(5); $js = $form->js(3); $template_content = <<html(5); $js = $form->js(6); $template_content = <<method() === 'GET') { $table = $request->get('table'); - $form = LayuiForm::buildForm($table); + $form = Layui::buildForm($table); return view("table/insert", [ 'form' => $form, 'table' => $table @@ -1248,7 +1248,7 @@ EOF; $table_info = Util::getSchema($table, 'table'); $primary_key = $table_info['primary_key'][0] ?? null; $value = htmlspecialchars($request->get($primary_key, '')); - $form = LayuiForm::buildForm($table,'update'); + $form = Layui::buildForm($table,'update'); return view("table/update", [ 'primary_key' => $primary_key, 'value' => $value,