2个模型,A,B通过belongsTo 关联。
A belongsTo B,A中有外键b,B中无外键。
public function b(){
return $this->belongsTo('b','外键b','id')->bind([
'bTitle' => 'title',
]);
}
能通过->with('b')->paginate(10);
分页查询出来结果。现在要做的是,根据B表中的ti
文档没说明,然后随意乱写了一些,代码,没什么用
->withFWhere('b',['title'=>111])->paginate(10);
求大佬指点5.0文档中有 hasone 的条件查询,但是没有belongsWhere的用法??
$user = User::hasWhere('profile',['email'=>'thinkphp@qq.com'])->find();
echo $user->name
最佳答案
