<?php
/*
    * Created by VahabDev in Aparat Live
    * Website: https://pourfi.ir
    * Aparat Live: https://www.aparat.com/vahabdev/live
    * Aparat Channel: https://www.aparat.com/vahabdev
    * Rubika Channel: https://rubika.ir/vahabdev
    * Donate: https://reymit.ir/vahabdev
    * Telegram: https://t.me/vahabdev
*/


namespace App\Http\Controllers;


use App\Models\Blog;
use App\Models\Product;
use App\Models\productCategories;
use Illuminate\Http\Request;

class indexController extends Controller
{
    public function index(){

        $lastProducts = Product::orderBy('id', 'desc')
            ->where('status', 'active')
            ->with('category')
            ->take(8)
            ->get();

        $lastPost = Blog::orderBy('id', 'desc')
            ->where('status', 'published')
            ->with('category')
            ->take(6)
            ->get();


        return view('site.index', compact(
            'lastProducts',
            'lastPost',
        ));
    }


}
