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:
@@ -1,5 +1,5 @@
|
||||
|
||||
public function {{relationMethod}}()
|
||||
{
|
||||
return $this->belongsTo('{{relationModel}}', '{{foreignKey}}', '{{primaryKey}}');
|
||||
return $this->hasOne({{relationModel}}, '{{foreignKey}}', '{{primaryKey}}'){{relationFields}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user