Fork Me On Github
zodream zodream框架 2019-01-05

使用方法


$this->hasOne(class, 'local_key', 'foreign_key');
$this->hasOne(table, table_id, id);

$this->hasMany(class, 'local_key', 'foreign_key');
$this->hasMany(table, id, table_id);

流程

with('w')
with(['w' => function($query) { $query->select('a') }])
with('w:a')
    eagerLoad['w'] = function(){}
    eagerLoad['w'] = function($query) { $query->select('a') }
    eagerLoad['w'] = function($query) { $query->select('a') }

get()
    $model->w()
        $this->hasOne(table, table_id, id)
        $this->hasOne(table, table_id, id)->select('');
            Relation{table, local_key, foreign_key} : Query

    eagerLoad['w'](Relation)
    Relation(id[])->getResult()

    w => array
点击查看全文
0 172 0