feat(curd): 关联表优化支持 add relation support and optimize model associations

- Add support for handling relations in CURD operations
- Optimize model associations to use hasOne instead of belongsTo
- Implement field selection for relations
- Update controller to handle AJAX requests and return JSON data Modify model to include relation methods
This commit is contained in:
wolfcode
2025-04-16 15:28:41 +08:00
parent d513177c74
commit 3a2ee69d0f
5 changed files with 41 additions and 13 deletions

View File

@@ -17,8 +17,9 @@ class {{controllerName}} extends AdminController
{
parent::__construct($app);
self::$model = {{modelFilename}}::class;
$this->notes = $notes = self::$model::$notes;
$notes = self::$model::$notes;
{{constructRelation}}
$this->notes =$notes;
$this->assign(compact('notes'));
}