orm. with
StoreFinancial::query()->where(‘start_at’,’<’,time())->with([‘Store’=>function($query) use ($keyword){
$query->when($keyword,function ($query1) use ($keyword){
$query1->where(‘Id’,’like’,’%’.$keyword.’%’)
->orWhere(‘Name’,’like’,’%’.$keyword.’%’)
->orWhere(‘Mobile’,’like’,’%’.$keyword.’%’);
});
},’Store.address’])
->paginate($request->get(‘pageSize’,20));
推荐文章: