Vues des menus : utilisation d'un layout HTML commun
* Utilisation d'un template HTML commun pour les deux vues suivantes : * index des menus * ajout d'un nouveau menu
This commit is contained in:
parent
1bfa397146
commit
2a6e355483
14
resources/views/layouts/app.blade.php
Normal file
14
resources/views/layouts/app.blade.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>@yield('title')</title>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>Aucun contenu pour le moment.</p>
|
||||||
|
@show
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,12 +1,21 @@
|
|||||||
<form method="POST" action="{{ route('menus.store') }}">
|
@extends('layouts.app')
|
||||||
@csrf
|
|
||||||
|
|
||||||
<label for="title">Titre du menu</label>
|
@section('title', 'Ajouter un menu')
|
||||||
<input id="title" name="title" type="text" class="@error('title') is-invalid @enderror">
|
|
||||||
|
|
||||||
@error('title')
|
@section('content')
|
||||||
<div class="alert alert-danger">{{ $message }}</div>
|
<h1>Ajouter un menu</h1>
|
||||||
@enderror
|
|
||||||
|
|
||||||
<input type="submit" value="Nouveau menu">
|
<form method="POST" action="{{ route('menus.store') }}">
|
||||||
</form>
|
@csrf
|
||||||
|
|
||||||
|
<label for="title">Titre du menu</label><br />
|
||||||
|
<input id="title" name="title" type="text" class="@error('title') is-invalid @enderror"><br />
|
||||||
|
|
||||||
|
@error('title')
|
||||||
|
<div class="alert alert-danger">{{ $message }}</div>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
<input type="submit" value="Nouveau menu">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Menus')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1>Menus aléatoires</h1>
|
||||||
|
|
||||||
|
@if ($menus)
|
||||||
|
<ul>
|
||||||
@foreach($menus as $menu)
|
@foreach($menus as $menu)
|
||||||
<li>{{ $menu->title }}</li>
|
<li>{{ $menu->title }}</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
@else
|
||||||
|
<p>Aucun menu trouvé.</p>
|
||||||
|
@endif
|
||||||
|
|
||||||
<p><a href="{{ route('menus.create') }}">Nouveau</a></p>
|
<p><a href="{{ route('menus.create') }}">Ajouter un menu</a></p>
|
||||||
|
@endsection
|
||||||
|
Loading…
Reference in New Issue
Block a user