year; $dataChartTransaction = []; $dataChartRefund = []; for($bulan = 1; $bulan <= 12; $bulan++){ $transaction = Transaction::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar'); // $transaction = Transaction::where('status','finished')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar'); // $refund = Refund::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total'); // $refund = Refund::where('status','Partial Refund')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total'); $dataChartTransaction[] = intval($transaction); // $dataChartRefund[] = intval($refund); } return view('admin.index',[ "transaction"=>Transactions::allTransactions(), "dataChartTransaction" => $dataChartTransaction, // "dataChartRefund" => $dataChartRefund ]); } public function profile(){ return view('admin.profile.index'); } }