利用with whereHas 获取携带用户名的订单列表
案例:
//Controller:
public function CoinChange(Request $request, AccountChangeService $accountChangeService)
{
$params = $request->all();
$where = $userWhere = [];
if (isset($params['account_no'])) {
$where[] = ['account_no', 'like', '%' . $params['account_no'] . '%'];
}
if(isset($params['start_time']) && !empty($params['start_time']))
{
$where[] = ['created_at','>',strtotime($params['start_time'])];
}
if(isset($params['end_time']) && !empty($params['end_