<?php

namespace App\Http\Controllers\Web;

use App\Models\Brand;
use App\Models\Category;
use App\Models\Page;
use App\Models\Partner;
use App\Models\Product;
use App\Models\Slider;
use App\Models\Review;
use Illuminate\Http\Request;
use Illuminate\View\View;
use App\Http\Controllers\Controller;

class HomeController extends Controller
{
    private $view = 'web.pages.home.';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        // $this->middleware('auth')->except('lang');
    }

    /**
     * Show the application dashboard.
     * @return View
     */

    public function index(Request $request) :View
    {
        $title = __('web.home');
        $sliders = Slider::withDescription()->where('sliders.status','slider')->cursor();
        $brands = Brand::withDescription()->cursor();
        $categories = Category::withDescription()->where('categories.category_id',null)->cursor();
        $products = Product::withDescription()->where('products.most_sale','true')->cursor();
        $reviews = Review::withDescription()->cursor();
        $banner = Slider::withDescription(2)->first();
        $pages = Page::withDescription([19,20,21,22])->cursor();

        return view($this->view.'home', get_defined_vars());
    }



}
