<?php

namespace App\Http\Controllers\Front;

use App\Http\Controllers\Controller;
use App\Models\Brand;
use App\Models\DeviceInterface;
use App\Models\HowItWork;
use App\Models\PaymentProcess;
use App\Models\PremiumFeature;
use App\Models\Product;
use App\Models\Slider;
use App\Models\TopSeller;
use App\Models\Update;

class HomeController extends Controller
{
    public function index()
    {
        $sliders = Slider::active()->ordered()->get();
        $featuredProducts = Product::active()->featured()->with('category', 'primaryImage')->take(8)->get();
        $updates = Update::active()->ordered()->get();
        $brands = Brand::active()->ordered()->get();
        $topSellers = TopSeller::active()->ordered()->get();
        $interfaces = DeviceInterface::active()->whereNotNull('image')->ordered()->get();
        $paymentProcesses = PaymentProcess::active()->get();
        $howItWorks = HowItWork::active()->ordered()->get();
        $premiumFeatures = PremiumFeature::active()->ordered()->get();

        return view('front.home', compact(
            'sliders', 'featuredProducts', 'updates', 'brands', 'topSellers', 'interfaces', 'paymentProcesses', 'howItWorks', 'premiumFeatures'
        ));
    }
}
