<?php

namespace App\Http\Controllers\Admin\Pages\Home;

use App\Http\Controllers\Controller;
use App\Models\MenuCategory;
use App\Models\Menyu;
use App\Traits\Home;


class HomeController extends Controller
{
    use Home;

    public function home(){

        $menuCategories=MenuCategory::take(4)->get();
        $categories = MenuCategory::withCount('menyus')->take(4)->get();
        $categoriesNumber = MenuCategory::withCount('menyus')->take(4)->get();
        $menyus=Menyu::take(5)->get();
        $totalCategories =MenuCategory::count();
        $totalMenyus=Menyu::count();
        $totalPrice=Menyu::sum('price');

        return view('app.admin.home.home',compact([
            'menuCategories',
            'menyus',
            'categories',
            'totalCategories',
            'totalMenyus',
            'totalPrice',
            'categoriesNumber',
        ]));
    }
}
