refactor(curd): improve relation handling and query methods
- Replace with() with withJoin() for more efficient left joins - Fix foreign key and primary key assignments in relations - Update index page queries to use relation index method-Modify relation method generation in model to use belongsTo instead of hasOne- Adjust table column definitions for relation fields
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
return $this->selectList();
|
||||
}
|
||||
list($page, $limit, $where) = $this->buildTableParams();
|
||||
$count = self::$model::where($where)->count();
|
||||
$count = self::$model::where($where)->{{relationIndexMethod}}->count();
|
||||
$list = self::$model::where($where)->{{relationIndexMethod}}->page($page, $limit)->order($this->sort)->select()->toArray();
|
||||
$data = [
|
||||
'code' => 0,
|
||||
|
||||
Reference in New Issue
Block a user