0
欢迎, 我尝试通过“with”结合laravel中几个表中的数据我现在有这样的事情,我不知道如何做到这一点与第二个电话是表1的主要关键字laravel DB,获取所有数据表格
$profil = Profil::where('ghost', Chat::GHOST_NO);
$profil->with(['avatar_profils' => function($query) {
$query->where('id_profil', '=', Session::get('profil')->id);
}]);
$profil->with(['msg_profils' => function($query) {
$query->where('id_profil', '=', ??);
}]);
如何将查询插入到“??”在msg_profils中?
我相信''profil-> with('msg_profils')'就足够了,因为Laravel会自动匹配外键。 –
所以正常工作谢谢:) – Matx132
我写评论作为答案,请设置为正确 –