thinkphp5.1 关联预载入with() 函数查询问题

$list = $list->where('unreceivable','<>',0)->with(['details'=>function($query){
                                    $query->where('state',1)->where('money > actual_money');
            }]);

这个查询条件查出来的是满足where()条件的所有数据 如果不满足with闭包中的数据details中就是空

我现在想要的是满足where()条件和with中的where条件的数据,如果不满足闭包中中的条件的数据 就查不出来

https://blog.csdn.net/myarche/article/details/78832450

已解决 最后用join 联表查询做的 , 大神们谁有更好的方法希望可以提出来