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')
|
||||
|
||||
@section('title', 'Ajouter un menu')
|
||||
|
||||
@section('content')
|
||||
<h1>Ajouter un menu</h1>
|
||||
|
||||
<form method="POST" action="{{ route('menus.store') }}">
|
||||
@csrf
|
||||
|
||||
<label for="title">Titre du menu</label>
|
||||
<input id="title" name="title" type="text" class="@error('title') is-invalid @enderror">
|
||||
<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>
|
||||
</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)
|
||||
<li>{{ $menu->title }}</li>
|
||||
@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