<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use App\Models\User\Member;
use App\Models\User\Purchase;
use App\Models\User\Salesitem;
use App\Models\User\Purchaseitem;
use Illuminate\Http\Request;

class UserController extends Controller
{
   public function dashboard()
{
    $supplierCount = Member::where('type', 'Supplier')->count();
    $customerCount = Member::where('type', 'Customer')->count();
    
    // Change 'total_amount' to your correct column name
    $todaysales = Salesitem::whereDate('sales_date', today())->sum('amount');
    $todaypurchase =Purchaseitem::where('purchase_date', today())->sum('amount');

    return view('user.dashboard', compact('supplierCount', 'customerCount', 'todaysales', 'todaypurchase'));
}

}
