<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\AppOrder;
use App\Models\CompanySetting;
// use Illuminate\Support\Facades\Config;

class DashboardController extends Controller
{
    public function index()
    {
        // $userOrders = $this->userOrders();
        // $companySettings = Config::get('company_settings');

        $companySettings = CompanySetting::find(1);
        // dd($companySettings);

        $CustomerNo = auth()->user()->CustomerNo;
        $userOrders = AppOrder::where('CustomerNo', $CustomerNo)->count();

        return response()->json(['status' => true, 'data' => ['total_orders' => $userOrders, 'companySettings' => $companySettings] ], 200);
    }




}