ldc-doux/app/Http/Controllers/GammesController.php
2021-12-22 17:32:05 +01:00

25 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'));
}
}