38 lines
988 B
PHP
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'));
|
|
}
|
|
}
|