TP6 et avant
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<h2>Ajouter un produit</h2>
|
||||
<form method="POST" action="{{ route('products.store') }}">
|
||||
@csrf
|
||||
<label>Nom</label>
|
||||
<input type="text" name="name" value="{{ old('name') }}">
|
||||
@error('name')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<label>Prix</label>
|
||||
<input type="number" name="price" value="{{ old('price') }}">
|
||||
@error('price')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<label>Stock</label>
|
||||
<input type="number" name="stock" value="{{ old('price') }}">
|
||||
@error('stock')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<button type="submit">
|
||||
Enregistrer
|
||||
</button>
|
||||
</form>
|
||||
@endsection
|
||||
@@ -0,0 +1,26 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<h2>Modifier un produit</h2>
|
||||
<form method="POST" action="{{ route('products.update', $product) }}">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<label>Nom</label>
|
||||
<input type="text" name="name" value="{{ $product->name }}">
|
||||
@error('name')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<label>Prix</label>
|
||||
<input type="number" name="price" value="{{ $product->price }}">
|
||||
@error('price')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<label>Stock</label>
|
||||
<input type="number" name="stock" value="{{ $product->stock }}">
|
||||
@error('stock')
|
||||
<div>{{ $message }}</div>
|
||||
@enderror
|
||||
<button type="submit">
|
||||
Enregistrer
|
||||
</button>
|
||||
</form>
|
||||
@endsection
|
||||
@@ -0,0 +1,41 @@
|
||||
@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
|
||||
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<h2>{{ $product->name }}</h2>
|
||||
<p>Prix : {{ $product->price }}</p>
|
||||
<p>Stock : {{ $product->stock }}</p>
|
||||
<a href="{{ route('products.index') }}">
|
||||
Retour
|
||||
</a>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user