ldc-nature-and-respect/app/Http/Controllers/Fo/HomeController.php

31 lines
894 B
PHP
Raw Permalink Normal View History

2023-03-15 10:31:55 +01:00
<?php
namespace App\Http\Controllers\Fo;
use App\Enums\StaticPageType;
2023-03-15 10:31:55 +01:00
use App\Http\Controllers\Controller;
use App\Models\Home;
use App\Models\Slider;
use App\Models\StaticPage;
2023-03-15 10:31:55 +01:00
class HomeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\View\View
*/
public function index(): \Illuminate\Contracts\View\View
2023-03-15 10:31:55 +01:00
{
$staticPageModel = StaticPage::query()->where('type', StaticPageType::home)->firstOrFail();
$currentLocale = app()->currentLocale();
$home = Home::query()->firstOrFail();
$sliders = Slider::query()
->where('status', true)
->orderBy('order')
->whereJsonContains('locales', $currentLocale)
->get();
return view('fo.pages.home', compact('staticPageModel', 'home', 'sliders'));
2023-03-15 10:31:55 +01:00
}
}