38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\Slides\SliderTypeEnum;
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\News;
|
|
use App\Models\Section;
|
|
use App\Models\Slide;
|
|
use App\Models\StaticPage;
|
|
use App\Models\Strip;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function index(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::home)->first();
|
|
$sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get();
|
|
$stripModels = Strip::query()->where('published', true)
|
|
->orderBy('publish_at', 'DESC')
|
|
->limit(12)
|
|
->with('news')
|
|
->get();
|
|
$newsModels = News::query()->where('published', true)
|
|
->orderBy('publish_at', 'DESC')
|
|
->limit(4)
|
|
->get();
|
|
$slideModels = Slide::query()->where('slider', SliderTypeEnum::home)->get();
|
|
|
|
return view('fo.pages.home', compact('staticPageModel', 'sectionModels', 'stripModels', 'newsModels', 'slideModels'));
|
|
}
|
|
}
|