Delete paddocks

This commit is contained in:
2020-04-17 09:13:58 +02:00
parent cf6d0ab467
commit 19e1123ef5
2 changed files with 12 additions and 1 deletions

View File

@@ -90,6 +90,9 @@ class PaddockController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
// Paddock::where('id', $id)->delete();
return Redirect::to('paddocks')
->with('success','Enclos supprimé.');
} }
} }

View File

@@ -14,6 +14,7 @@
<th>Id</th> <th>Id</th>
<th>Nom</th> <th>Nom</th>
<th>État</th> <th>État</th>
<th>Actions</th>
</thead> </thead>
<tbody> <tbody>
@foreach($paddocks as $paddock) @foreach($paddocks as $paddock)
@@ -21,6 +22,13 @@
<td>{{ $paddock->id }}</td> <td>{{ $paddock->id }}</td>
<td>{{ $paddock->name }}</td> <td>{{ $paddock->name }}</td>
<td>{{ $paddock->isClosed ? 'Fermé' : 'Ouvert' }}</td> <td>{{ $paddock->isClosed ? 'Fermé' : 'Ouvert' }}</td>
<td>
<form action="{{ route('paddocks.destroy', $paddock->id)}}" method="post">
{{ csrf_field() }}
@method('DELETE')
<button type="submit">Supprimer</button>
</form>
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>