Delete paddocks
This commit is contained in:
@@ -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é.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user