//with关联查询
$user = User::with(['userPartner'=>function($q){
$q->where('partner_id',(new LoginService())->getUserId('partner'));
}])->orderBy('id', 'desc');
//where has关联查询
if ($request->filled('status')) {
$user->whereHas('userPartner', function ($query) use ($request) {
$query->where('status', $request->input('status') );
});
}