migrate template
This commit is contained in:
53
app/Http/Controllers/HomeController.php
Normal file
53
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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',
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user