26 lines
663 B
PHP
26 lines
663 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers;
|
||
|
|
|
||
|
|
use App\Models\Gamme;
|
||
|
|
use App\Models\Product;
|
||
|
|
|
||
|
|
class GammesController extends Controller
|
||
|
|
{
|
||
|
|
public function index()
|
||
|
|
{
|
||
|
|
$gammes = Gamme::whereNull('parent_gamme_id')->orderBy('title')->get();
|
||
|
|
$nb_gammes = $gammes->count();
|
||
|
|
|
||
|
|
return view('front.gammes.index', compact('gammes', 'nb_gammes'));
|
||
|
|
}
|
||
|
|
|
||
|
|
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||
|
|
public function show(Gamme $gamme)
|
||
|
|
{
|
||
|
|
$products = Product::where('gamme_id', $gamme->id)->orderBy('name')->get();
|
||
|
|
|
||
|
|
return view('front.gammes.show', compact('gamme', 'products'));
|
||
|
|
}
|
||
|
|
}
|