Files
2026-10-07 16:34:12 +02:00

41 lines
882 B
PHP

@extends('layouts.app')
@section('content')
<h2>Liste des products</h2>
<a href="{{ route('products.create') }}">
Ajouter un produit
</a><form method="GET" action="{{ route('products.index') }}">
<input
type="text"
name="search"
placeholder="Rechercher un produit"
value="{{ $search }}"
>
<button type="submit">
Rechercher
</button>
</form>
<p>Nombre de produit: {{$products->count()}}</p>
@foreach($products as $product)
<p>
{{ $product->name }}
-
{{ $product->price }} $
-
{{ $product->stock }}
<a href="{{ route('products.show', $product) }}">
Voir
</a>
| <a href="{{ route('products.edit', $product) }}">Modifier</a>
| <form method="POST"
action="{{ route('products.destroy', $product) }}">
@csrf
@method('DELETE')
<button type="submit">
Supprimer
</button>
</form>
</p>
</p>
@endforeach
@endsection