user(); $accounts = CustomerAccount::withoutGlobalScope('store') ->where('customer_id', $customer->id) ->get(); return $this->success($accounts); } /** * 账户流水记录(分页) */ public function transactions(Request $request): JsonResponse { /** @var Customer $customer */ $customer = $request->user(); $query = AccountTransaction::withoutGlobalScope('store') ->whereHas('account', fn ($q) => $q->where('customer_id', $customer->id)); if ($request->filled('account_id')) { $query->where('customer_account_id', (int) $request->input('account_id')); } return $this->paginate( $query->orderByDesc('id')->paginate(20) ); } }