jk
3 years ago
7 changed files with 234 additions and 29 deletions
-
7app/Http/Controllers/BrewerieController.php
-
96app/Http/Controllers/GrainController.php
-
2resources/views/beers/create.blade.php
-
56resources/views/grains/create.blade.php
-
55resources/views/grains/edit.blade.php
-
40resources/views/grains/index.blade.php
-
7routes/web.php
@ -0,0 +1,56 @@ |
|||||
|
@extends('grains') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Add a Grain</h1> |
||||
|
<div> |
||||
|
@if ($errors->any()) |
||||
|
<div class="alert alert-danger"> |
||||
|
<ul> |
||||
|
@foreach ($errors->all() as $error) |
||||
|
<li>{{ $error }}</li> |
||||
|
@endforeach |
||||
|
</ul> |
||||
|
</div><br /> |
||||
|
@endif |
||||
|
<form method="post" action="{{ route('grains.store') }}"> |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="name">Name</label> |
||||
|
<input type="text" class="form-control" name="name"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="flavour">Flavour</label> |
||||
|
<textarea type="text" class="form-control" name="flavour" ></textarea> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="colour">Colour</label> |
||||
|
<input type="text" class="form-control" name="colour"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="lintner">Lintner</label> |
||||
|
<input type="text" class="form-control" name="lintner"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="winkol">Windisch-Kolbach</label> |
||||
|
<input type="text" class="form-control" name="winkol"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="lovibond">Lovibond</label> |
||||
|
<input type="text" class="form-control" name="lovibond"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="ebc">EBC</label> |
||||
|
<input type="text" class="form-control" name="ebc"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="alternative">Alternative(s)</label> |
||||
|
<inpu type="text" class="form-control" name="alternative"> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Add Grain</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,55 @@ |
|||||
|
@extends('grains') |
||||
|
@section('main') <div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Update Grain</h1> |
||||
|
|
||||
|
@if ($errors->any()) |
||||
|
<div class="alert alert-danger"> |
||||
|
<ul> |
||||
|
@foreach ($errors->all() as $error) |
||||
|
<li>{{ $error }}</li> |
||||
|
@endforeach |
||||
|
</ul> |
||||
|
</div> |
||||
|
<br /> |
||||
|
@endif |
||||
|
<form method="post" action="{{ route('grains.update', $grain->id) }}"> |
||||
|
@method('PATCH') |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="name">Name</label> |
||||
|
<input type="text" class="form-control" name="name" value="{{$grain->name}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="flavour">Flavour</label> |
||||
|
<textarea type="text" class="form-control" name="flavour" />{{$grain->flavour}}</textarea> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="colour">Colour</label> |
||||
|
<input type="text" class="form-control" name="colour" value="{{$grain->colour}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="lintner">Lintner</label> |
||||
|
<input type="text" class="form-control" name="lintner" value="{{$grain->lintner}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="winkol">Windisch-Kolbach</label> |
||||
|
<input type="text" class="form-control" name="winkol" value="{{$grain->winkol}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="lovibond">Lovibond</label> |
||||
|
<input type="text" class="form-control" name="lovibond" value="{{$grain->lovibond}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="ebc">EBC</label> |
||||
|
<input type="text" class="form-control" name="ebc" value="{{$grain->ebc}}"/> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="alternative">Alternative(s)</label> |
||||
|
<inpu type="text" class="form-control" name="alternative" value="{{str_replace(' ,',',',str_replace('"',' ',str_replace(',',', ',str_replace('}', '', str_replace('{','',$grain->alternative)))))}}"/>
|
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Update</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,40 @@ |
|||||
|
@extends('grains') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="container"> |
||||
|
<div class="row justify-content-center"> |
||||
|
<div class="col-md-8"> |
||||
|
<div class="card"> |
||||
|
@include('inc.navbar') |
||||
|
<div class="card-header"><a href="/home">Home</a> -> {{ __('Grain List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
||||
|
|
||||
|
<div class="card-body"> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<a href="{{ route('grains.create') }}" class="btn btn-primary">Add Grain</a> |
||||
|
<hr /> |
||||
|
@endif |
||||
|
<table class="table table-striped table-dark" id="table-programs"> |
||||
|
<!-- This piece of code is for error messages display purposes --> |
||||
|
@include('inc.messages') |
||||
|
|
||||
|
<tbody> |
||||
|
@foreach ($grains as $grain) |
||||
|
<tr> |
||||
|
<td><a href="/grain/{{$grain->id}}">{{$grain->name}}</a> </td> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<td><a href="{{ route('grains.edit',$grain->id)}}" class="btn btn-primary">Edit</a></td> |
||||
|
<td><form action="{{ route('grains.destroy', $grain->grain_id)}}" method="post"> |
||||
|
@csrf |
||||
|
@method('DELETE') |
||||
|
<button class="btn btn-danger" type="submit">Delete</button> |
||||
|
</form></td> |
||||
|
@endif |
||||
|
</tr> |
||||
|
@endforeach |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue