refactor(curd): optimize relation binding and code generation

- Move relation binding logic from model constructor to controller
- Generate controller code for binding select fields-Remove unnecessary code and templates
- Improve code readability and maintainability
This commit is contained in:
wolfcode
2024-12-20 17:09:04 +08:00
parent 5d58248cf4
commit 55a9b13e69
4 changed files with 29 additions and 30 deletions

View File

@@ -20,6 +20,7 @@ class {{controllerName}} extends AdminController
parent::__construct($app);
$this->model = new {{modelFilename}}();
$this->notes = $notes = $this->model->notes;
{{constructRelation}}
$this->assign(compact('notes'));
}