List all paddocks, create new paddock.

All paddocks new paddocks are closed.
This commit is contained in:
2020-04-17 09:08:22 +02:00
parent dcd75c3358
commit cf6d0ab467
7 changed files with 217 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
@extends('paddock.layout')
@section('content')
<h2>Nouvel enclos</h2>
<br>
<form action="{{ route('paddocks.store') }}" method="POST">
{{ csrf_field() }}
<strong>Nom</strong>
<input type="text" name="name" placeholder="Nom de l'enclos">
<span class="text-danger">{{ $errors->first('name') }}</span>
<button type="submit">Créer</button>
</form>
@endsection

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Jurassic Land</title>
</head>
<body>
<h1>Jurassic Land</h1>
<div class="container">
@yield('content')
</div>
</body>
</html>

View File

@@ -0,0 +1,34 @@
@extends('paddock.layout')
@section('content')
@if (count($paddocks) > 0)
<div>
<a href="{{ route('paddocks.create') }}">Ajouter un enclos</a>
</div>
<br>
<table class="table table-bordered" id="laravel_crud">
<thead>
<tr>
<th>Id</th>
<th>Nom</th>
<th>État</th>
</thead>
<tbody>
@foreach($paddocks as $paddock)
<tr>
<td>{{ $paddock->id }}</td>
<td>{{ $paddock->name }}</td>
<td>{{ $paddock->isClosed ? 'Fermé' : 'Ouvert' }}</td>
</tr>
@endforeach
</tbody>
</table>
{!! $paddocks->links() !!}
@else
<div><p>Aucun enclos dans ce parc.</p></div>
<div><a href="{{ route('paddocks.create') }}">Ajouter un enclos</a></div>
@endif
@endsection