<?php

namespace App\Http\Controllers\Frontend;

use App\Http\Controllers\Controller;
use App\Models\BlogPost;
use App\Models\Product;

class HomeController extends Controller
{
    protected array $data;

    public function index() {
        $products = Product::latest('id')->withAvg('reviews', 'rating')->paginate(setting('products.on_homepage', 6));
        $posts = BlogPost::latest('id')->paginate(setting('posts.on_homepage', 3));
        return view('theme::pages.home', compact('products', 'posts'));
    }
}
