Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function index($id)
- {
- $thisYears = date('Y');
- $thisMonth = date('m');
- $produk = Product::findOrFail($id);
- $transaksi = Transaction::where('product_id', $produk->id)
- ->where('created_at', 'LIKE','%'.$thisYears.'%')
- // ->Where('status','!=','Menunggu')
- ->get();
- $totalTrans = $transaksi->count();
- /*Date*/
- $months = array(1 => 'Januari', 2 => 'Februari', 3 => 'Maret', 4 => 'April', 5 => 'Mei', 6 => 'Juni', 7 => 'Juli', 8 => 'Agustus', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Desember');
- $transposed = array_slice($months, date('n'), 12, true) + array_slice($months, date('n'), true);
- $last8 = array_reverse(array_slice($transposed, -8, 12, true), true);
- return view('admin.product.insight.index', compact('transaksi','totalTrans','thisMonth','months','transposed','last8'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement