54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Category;
|
|
use App\Models\FooterNavLink;
|
|
use App\Models\HeroSlide;
|
|
use App\Models\SignatureItem;
|
|
use App\Models\SiteSetting;
|
|
use App\Models\SocialLink;
|
|
use App\Models\TimelineEntry;
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index(): View
|
|
{
|
|
$heroSlides = HeroSlide::where('is_active', true)
|
|
->orderBy('sort_order')
|
|
->get();
|
|
|
|
$categories = Category::where('is_active', true)
|
|
->orderBy('sort_order')
|
|
->with([
|
|
'products' => fn ($query) => $query
|
|
->where('is_active', true)
|
|
->orderBy('sort_order'),
|
|
])
|
|
->get();
|
|
|
|
$signatureItems = SignatureItem::where('is_active', true)
|
|
->orderBy('sort_order')
|
|
->get();
|
|
|
|
$timelineEntries = TimelineEntry::orderBy('sort_order')->get();
|
|
|
|
$footerNavLinks = FooterNavLink::orderBy('sort_order')->get();
|
|
|
|
$socialLinks = SocialLink::orderBy('sort_order')->get();
|
|
|
|
$settings = SiteSetting::pluck('value', 'key');
|
|
|
|
return view('welcome', compact(
|
|
'heroSlides',
|
|
'categories',
|
|
'signatureItems',
|
|
'timelineEntries',
|
|
'footerNavLinks',
|
|
'socialLinks',
|
|
'settings',
|
|
));
|
|
}
|
|
}
|