filled('startDate') ? Carbon::parse($request->startDate)->startOfDay() : Carbon::now()->startOfDay(); $endDate = $request->filled('endDate') ? Carbon::parse($request->endDate)->startOfDay() : Carbon::now()->startOfDay(); $responseTransactionSortedByTotalCawanganPayment = Http::get(config('api.url') . '/api/reports/bayaran-online', [ 'startDate' => $startDate->toDateString(), 'endDate' => $endDate->toDateString(), 'orderBy' => 'totalCawanganPayment', ]); $responseTransactionSortedByTotalReferenceNo = Http::get(config('api.url') . '/api/reports/bayaran-online', [ 'startDate' => $startDate->toDateString(), 'endDate' => $endDate->toDateString(), 'orderBy' => 'totalReferenceNo', ]); if($responseTransactionSortedByTotalCawanganPayment->failed() OR $responseTransactionSortedByTotalReferenceNo->failed()){ throw new \Exception("Something wrong with the API", 1); } $data = [ 'sortedByTotalCawanganPayment' => $responseTransactionSortedByTotalCawanganPayment->json(), 'sortedByTotalReferenceNo' => $responseTransactionSortedByTotalReferenceNo->json(), ]; return view('reports.bayaran-online.index', compact('data', 'startDate', 'endDate')); } }