belongsTo('Game', 'gameid', 'id'); } public function getServerList($where,$order='',$whereor='') { if (empty($order)){ $order = 'sertime desc'; } if (empty($whereor)){ return ServerInfo::with(['game'=>function($query){ $query->field('id,name'); }])->where($where)->order($order)->paginate(20); }else{ return ServerInfo::with(['game'=>function($query){ $query->field('id,name'); }])->where($where)->whereOr($whereor)->order($order)->paginate(20); } } }