List all paddocks, create new paddock.
All paddocks new paddocks are closed.
This commit is contained in:
17
resources/views/paddock/create.blade.php
Normal file
17
resources/views/paddock/create.blade.php
Normal 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
|
||||
16
resources/views/paddock/layout.blade.php
Normal file
16
resources/views/paddock/layout.blade.php
Normal 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>
|
||||
34
resources/views/paddock/list.blade.php
Normal file
34
resources/views/paddock/list.blade.php
Normal 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
|
||||
Reference in New Issue
Block a user