@extends('admin.layouts.master') @section('content')

Dashboard

@php $total_penjualan = DB::Table('pesanan') ->where('status', 'Barang Dalam Pengiriman') ->orWhere('status', 'selesai') ->get(); $total_customer = DB::Table('users') ->where('id', '!=', Auth::user()->id) ->get(); $total_pendapatan = DB::Table('pesanan') ->select(DB::raw('SUM(bayar) as total_pendapatan')) ->where('status', 'selesai') ->get(); $total_produk = DB::Table('pesanan') ->select(DB::raw('SUM(quantity) as total_produk')) ->where('status', 'selesai') ->get(); @endphp

Transaksi

{{ $total_penjualan->count() }}

Customer

{{ $total_customer->count() }}
@php function rupiah($angka) { $hasil_rupiah = 'Rp ' . number_format($angka, 2, ',', '.'); return $hasil_rupiah; } @endphp

Total Pendapatan:

@foreach ($total_pendapatan as $total_pendapatan)
@php echo rupiah($total_pendapatan->total_pendapatan) @endphp
@endforeach

Produk Terjual:

@foreach ($total_produk as $total_produk)
{{ $total_produk->total_produk }}
@endforeach

Produk Terjual

@endsection @section('css') @endsection @section('js') @endsection