ldc-gen-game-web/app/Http/Controllers/Fo/HomeController.php

39 lines
988 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Fo;
use App\Http\Controllers\Controller;
use App\Models\Range;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Gate;
class HomeController extends Controller
{
2022-08-11 10:26:29 +02:00
/**
* Display home page
2023-08-24 12:59:51 +00:00
*
* @return \Illuminate\Contracts\View\View
2022-08-11 10:26:29 +02:00
*/
public function home(): View
2020-10-29 15:40:23 +01:00
{
return view('theme::pages.home');
}
/**
* Display products with game stickers
*
* @return \Illuminate\Contracts\View\View
* @phpcs:ignore Squiz.Commenting.FunctionComment.EmptyThrows
* @throws \Illuminate\Http\Exceptions\HttpResponseException
*/
public function showProducts(): View
{
if (!Gate::allows('fo.showProducts')) {
\response()->redirectToRoute('fo.homepage')->throwResponse();
}
$rangeModelList = Range::query()->with('products')->orderBy('id')->get();
return view('theme::pages.products', compact('rangeModelList'));
}
}