<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public function index()
    {
        $carouselRows = \App\Models\HomeCarousel::where('is_front_show', '=', true)
            ->orderBy('lft', 'asc')
            ->orderBy('id', 'desc');
        $newsRows = \App\Models\News::where('is_front_show', '=', true)
            ->orderBy('post_at', 'desc')
            ->take('3');
        $eventRows = \App\Models\News::where('is_front_show', '=', true)
            ->orderBy('post_at', 'desc')
            ->take('3');
        return view('home', [
            'carouselRows' => $carouselRows->get(),
            'newsRows' => $newsRows->get(),
            'eventRows' => $eventRows->get(),
        ]);
    }
}
