ldc-gen-game-web/app/Http/Controllers/Fo/HomeController.php
Jérémy Munsch 232bc2f459
Tons of Bo fixes related to product and ranges,
add picture alt and titles + seeders + correct config
picture sizes
2023-11-29 15:33:23 +01:00

38 lines
988 B
PHP

<?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
{
/**
* Display home page
*
* @return \Illuminate\Contracts\View\View
*/
public function home(): View
{
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'));
}
}