Browse Source

hopadditions refactor mkI

master
jk 3 years ago
parent
commit
56d623fa92
  1. 50
      app/Http/Controllers/HopAdditionController.php
  2. 2
      app/Http/Controllers/MasheController.php
  3. 2
      resources/views/adjunct.blade.php
  4. 2
      resources/views/adjuncts/create.blade.php
  5. 2
      resources/views/adjuncts/edit.blade.php
  6. 2
      resources/views/adjuncts/index.blade.php
  7. 2
      resources/views/beer.blade.php
  8. 2
      resources/views/beers/create.blade.php
  9. 2
      resources/views/beers/edit.blade.php
  10. 2
      resources/views/beers/index.blade.php
  11. 2
      resources/views/breweries/create.blade.php
  12. 2
      resources/views/breweries/edit.blade.php
  13. 3
      resources/views/breweries/index.blade.php
  14. 2
      resources/views/brewery.blade.php
  15. 231
      resources/views/edit.blade.php
  16. 2
      resources/views/grain.blade.php
  17. 2
      resources/views/grainbill.blade.php
  18. 2
      resources/views/grainbills/create.blade.php
  19. 2
      resources/views/grainbills/edit.blade.php
  20. 2
      resources/views/grainbills/index.blade.php
  21. 2
      resources/views/grains/create.blade.php
  22. 2
      resources/views/grains/edit.blade.php
  23. 2
      resources/views/grains/index.blade.php
  24. 2
      resources/views/hop.blade.php
  25. 79
      resources/views/hopadditions.blade.php
  26. 40
      resources/views/hopadditions/create.blade.php
  27. 39
      resources/views/hopadditions/edit.blade.php
  28. 54
      resources/views/hopadditions/index.blade.php
  29. 2
      resources/views/hops/create.blade.php
  30. 2
      resources/views/hops/edit.blade.php
  31. 2
      resources/views/hops/index.blade.php
  32. 2
      resources/views/yeast.blade.php
  33. 2
      resources/views/yeasts/create.blade.php
  34. 2
      resources/views/yeasts/edit.blade.php
  35. 2
      resources/views/yeasts/index.blade.php
  36. 3
      routes/web.php

50
app/Http/Controllers/HopAdditionController.php

@ -4,6 +4,8 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Hopaddition;
use App\Models\Hop;
use App\Models\Summarie;
class HopAdditionController extends Controller
{
public function __construct()
@ -14,8 +16,15 @@ class HopAdditionController extends Controller
public function index()
{
$project = Hopaddition::orderBy('id')->get();
return view('hopadditions')->with('hopadditions', $project);
$hopadditions = Hopaddition::orderBy('id')->get();
foreach ($hopadditions as $hopaddition)
{
$beername = Summarie::where('beer_id', $hopaddition->beer_id)->value('name');
$hopname = Hop::where('id', $hopaddition->hop_id)->value('name');
$hopaddition['beer'] = $beername;
$hopaddition['hop'] = $hopname;
}
return view('hopadditions.index')->with('hopadditions', $hopadditions);
}
public function store(Request $request){
@ -26,11 +35,9 @@ class HopAdditionController extends Controller
'amount' => 'required',
'timing' => 'required',
]);
// create project
$hop = new Hopaddition;
$lastID = Hopaddition::orderBy('id','desc')->value('id');
$lastID = Hopaddition::orderBy('id','desc')->take(1)->value('id');
$hop->id = number_format($lastID) + 1;
$hop->beer_id = $request->input('beer_id');
$hop->hop_id = $request->input('hop_id');
@ -40,5 +47,38 @@ class HopAdditionController extends Controller
return redirect('/hopadditions')->with('success', 'Hop Addition Added');
}
public function edit($id){
$hopaddition = Hopaddition::where('id', (int)$id)->first();
return view('hopadditions.edit')->with('hopaddition', $hopaddition);
}
public function update(Request $request, $id){
// validation
$this->validate($request,[
'beer_id' => 'required',
'hop_id' => 'required',
'amount' => 'required',
'timing' => 'required',
]);
$hop = Hopaddition::where('id', (int)$id)->first();
$hop->beer_id = $request->input('beer_id');
$hop->hop_id = $request->input('hop_id');
$hop->amount = $request->input('amount');
$hop->timing = $request->input('timing');
$hop->save();
return redirect('/hopadditions')->with('success', 'Hop Addition Updated!');
}
public function create()
{
return view('hopadditions.create');
}
public function destroy($id)
{
$hopaddition = Hopaddition::find($id);
$hopaddition->delete();
return redirect('/hopadditions')->with('success', 'Hop Addition deleted!');
}
}

2
app/Http/Controllers/MasheController.php

@ -71,7 +71,7 @@ class MasheController extends Controller
$mash->boil = $request->input('boil');
$mash->save();
return redirect('/mashs')->with('success', 'Mash Step Updated!');
return redirect('/mashes')->with('success', 'Mash Step Updated!');
}
public function create()
{

2
resources/views/adjunct.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')

2
resources/views/adjuncts/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add an Adjunct</h1>
<div>
@if ($errors->any())

2
resources/views/adjuncts/edit.blade.php

@ -1,6 +1,6 @@
@extends('adjuncts')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Adjunct</h1>
@if ($errors->any())

2
resources/views/adjuncts/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Adjunct List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/beer.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> <a href="/beers">Beer List</a> -> {{ __('Beer Sheet') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/beers/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a Beer</h1>
<div>
@if ($errors->any())

2
resources/views/beers/edit.blade.php

@ -1,6 +1,6 @@
@extends('beers')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Beer</h1>
@if ($errors->any())

2
resources/views/beers/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Beer List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/breweries/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a brewery</h1>
<div>
@if ($errors->any())

2
resources/views/breweries/edit.blade.php

@ -1,6 +1,6 @@
@extends('breweries')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Brewery</h1>
@if ($errors->any())

3
resources/views/breweries/index.blade.php

@ -4,7 +4,7 @@
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Brewery List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
@ -50,4 +50,3 @@
</div>
</div>
@endsection

2
resources/views/brewery.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> <a href="/breweries">Brewery List</a> -> {{__('Brewery Sheet') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

231
resources/views/edit.blade.php

@ -1,231 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header"><a href="/home">Home</a> -> {{ __('Edit Page') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
<div class="card-body">
<ul id="editbuttons">
<li><button class="btn btn-primary btn-lg" data-toggle="gmodal" data-target="#gaddModal" type="button" name="gbutton" >
Add Grain Bill
</button></li>
<li><button class="btn btn-primary btn-lg" data-toggle="mmodal" data-target="#maddModal" type="button" name="mbutton" >
Add Mash Step
</button></li>
<li><button class="btn btn-primary btn-lg" data-toggle="hmodal" data-target="#haddModal" type="button" name="hbutton" >
Add Hop Addition
</button></li>
<li><button class="btn btn-primary btn-lg" data-toggle="amodal" data-target="#aaddModal" type="button" name="abutton" >
Add Adjunct Addition
</button></li>
<li><button class="btn btn-primary btn-lg" data-toggle="fmodal" data-target="#faddModal" type="button" name="fbutton" >
Add Fermentation Step
</button></li></ul>
</div>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="gaddModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Grain Bill</h5>
<button type="button" class="close" data-dismiss="gmodal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('gstore')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Grain ID</label>
<input type="text" class="form-control" name="grain_id" >
</div>
<div class="form-group">
<label for="">Amount</label>
<input type="text" class="form-control" name="amount">
</div>
<div class="form-group">
<label for="">% of Total Grain Bill</label>
<input type="text" class="form-control" name="grain_bill">
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="maddModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Grain</h5>
<button type="button" class="close" data-dismiss="mmodal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('mstore')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Temperature</label>
<input type="text" class="form-control" name="temp" >
</div>
<div class="form-group">
<label for="">Duration</label>
<input type="text" class="form-control" name="duration">
</div>
<div class="form-group">
<label for="">Stage</label>
<input type="text" class="form-control" name="stage">
</div>
<div class="form-group">
<label for="">Length of Boil</label>
<input type="text" class="form-control" name="boil">
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="haddModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Hop Addition</h5>
<button type="button" class="close" data-dismiss="hmodal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('hstore')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Hop ID</label>
<input type="text" class="form-control" name="hop_id" >
</div>
<div class="form-group">
<label for="">Amount</label>
<input type="text" class="form-control" name="amount">
</div>
<div class="form-group">
<label for="">Timing</label>
<input type="text" class="form-control" name="timing">
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="aaddModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Grain</h5>
<button type="button" class="close" data-dismiss="amodal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('astore')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Adjunct ID</label>
<input type="text" class="form-control" name="adjunct_id" >
</div>
<div class="form-group">
<label for="">Amount</label>
<input type="text" class="form-control" name="amount">
</div>
<div class="form-group">
<label for="">Timing</label>
<input type="text" class="form-control" name="timing">
</div>
<div class="form-group">
<label for="">Alternative (ID)</label>
<input type="text" class="form-control" name="alternative">
</div>
<div class="form-group">
<label for="">Notes</label>
<textarea type="text" class="form-control" name="notes"></textarea>
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="faddModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Fermentation</h5>
<button type="button" class="close" data-dismiss="fmodal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('fstore')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Yeast ID</label>
<input type="text" class="form-control" name="yeast_id" >
</div>
<div class="form-group">
<label for="">Temperature</label>
<input type="text" class="form-control" name="temperature">
</div>
<div class="form-group">
<label for="">Duration</label>
<textarea type="text" class="form-control" name="duration"></textarea>
</div>
<div class="form-group">
<label for="">Alternative (ID)</label>
<input type="text" class="form-control" name="alternative">
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
</div>
@endsection

2
resources/views/grain.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> <a href="/grains">Grain List</a> -> {{ __('Grain Card') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/grainbill.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
<div class="card-header"><a href="/home">Home</a> -> {{ __('Grain Bills') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/grainbills/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a Grain</h1>
<div>
@if ($errors->any())

2
resources/views/grainbills/edit.blade.php

@ -1,6 +1,6 @@
@extends('grainbills')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Grain Bill</h1>
@if ($errors->any())

2
resources/views/grainbills/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Grain Bills') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/grains/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a Grain</h1>
<div>
@if ($errors->any())

2
resources/views/grains/edit.blade.php

@ -1,6 +1,6 @@
@extends('grains')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Grain</h1>
@if ($errors->any())

2
resources/views/grains/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<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>

2
resources/views/hop.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> <a href="/hops">Hop List</a> -> {{ __('Hop Card') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

79
resources/views/hopadditions.blade.php

@ -1,83 +1,8 @@
@extends('layouts.app')
@section('content')
<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> -> {{ __('Hop Additions') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
<div class="card-body">
@if (Auth::user()->isAdmin())
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addModal" type="button" name="button" >
Add Hop Addition
</button>
<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')
<thead>
<tr>
<th scope="col">Beer ID</th>
<th scope="col">Hop ID</th>
<th scope="col">Amount</th>
<th scope="col">Timing</th>
</tr>
</thead>
<tbody>
@foreach ($hopadditions as $hopaddition)
<tr>
<td>{{$hopaddition->beer_id}} </td>
<td>{{$hopaddition->hop_id}} </td>
<td>{{$hopaddition->amount}} </td>
<td>{{$hopaddition->timing}} </td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- this code if for the modal -->
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="addModal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Hop Addition</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" >
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<form class="" action="{{route('hopadditions.store')}}" method="post">
{{csrf_field()}}
<div class="form-group">
<label for="">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="">Hop ID</label>
<input type="text" class="form-control" name="hop_id" >
</div>
<div class="form-group">
<label for="">Amount</label>
<input type="text" class="form-control" name="amount">
</div>
<div class="form-group">
<label for="">Timing</label>
<input type="text" class="form-control" name="timing">
</div>
<input type="submit" name="submit" value="Submit" class="btn btn-success">
</form>
</div>
</div>
</div>
<div class="container">
@yield('main')
</div>
@endsection

40
resources/views/hopadditions/create.blade.php

@ -0,0 +1,40 @@
@extends('hopadditions')
@section('main')
<div class="row">
<div class="col-sm-12 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('hopadditions.store') }}">
@csrf
<div class="form-group">
<label for="beer_id">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
</div>
<div class="form-group">
<label for="hop_id">Hop ID</label>
<input type="text" class="form-control" name="hop_id" >
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="text" class="form-control" name="amount">
</div>
<div class="form-group">
<label for="timing">Timing</label>
<input type="text" class="form-control" name="timing">
</div>
<button type="submit" class="btn btn-primary">Add Grain</button>
</form>
</div>
</div>
</div>
@endsection

39
resources/views/hopadditions/edit.blade.php

@ -0,0 +1,39 @@
@extends('hopadditions')
@section('main') <div class="row">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Hop Addition</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('hopadditions.update', $hopaddition->id) }}">
@method('PATCH')
@csrf
<div class="form-group">
<label for="beer_id">Beer ID</label>
<input type="text" class="form-control" name="beer_id" value="{{$hopaddition->beer_id}}" />
</div>
<div class="form-group">
<label for="hop_id">Hop ID</label>
<input type="text" class="form-control" name="hop_id" value="{{$hopaddition->hop_id}}" />
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="text" class="form-control" name="amount" value="{{$hopaddition->amount}}" />
</div>
<div class="form-group">
<label for="timing">Timing</label>
<input type="text" class="form-control" name="timing" value="{{$hopaddition->timing}}" />
</div>
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
</div>
@endsection

54
resources/views/hopadditions/index.blade.php

@ -0,0 +1,54 @@
@extends('hopadditions')
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Hop Additions') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>
<div class="card-body">
@if (Auth::user()->isAdmin())
<a href="{{ route('hopadditions.create') }}" class="btn btn-primary">Add Hop Addition</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')
<thead>
<tr>
<th scope="col">Beer</th>
<th scope="col">Hop</th>
<th scope="col">Amount</th>
<th scope="col">Timing</th>
@if (Auth::user()->isAdmin())<th colspan="2" scope="col">Admin</th>@endif
</tr>
</thead>
<tbody>
@foreach ($hopadditions as $hopaddition)
<tr>
<td><a href="/beer/{{$hopaddition->beer_id}}">{{$hopaddition->beer}}</a> </td>
<td><a href="/hop/{{$hopaddition->hop_id}}">{{$hopaddition->hop}}</a> </td>
<td>{{$hopaddition->amount}} </td>
<td>{{$hopaddition->timing}} </td>
@if (Auth::user()->isAdmin())
<td><a href="{{ route('hopadditions.edit',$hopaddition->id)}}" class="btn btn-primary">Edit</a></td>
<td><form action="{{ route('hopadditions.destroy', $hopaddition->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>
@endsection

2
resources/views/hops/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a Hop</h1>
<div>
@if ($errors->any())

2
resources/views/hops/edit.blade.php

@ -1,6 +1,6 @@
@extends('hops')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Grain</h1>
@if ($errors->any())

2
resources/views/hops/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Hop List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/yeast.blade.php

@ -3,7 +3,7 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> <a href="/yeasts">Yeast List</a> -> {{ __('Yeast Card') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

2
resources/views/yeasts/create.blade.php

@ -2,7 +2,7 @@
@section('main')
<div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Add a Yeast</h1>
<div>
@if ($errors->any())

2
resources/views/yeasts/edit.blade.php

@ -1,6 +1,6 @@
@extends('yeasts')
@section('main') <div class="row">
<div class="col-sm-8 offset-sm-2">
<div class="col-sm-12 offset-sm-2">
<h1 class="display-3">Update Yeast</h1>
@if ($errors->any())

2
resources/views/yeasts/index.blade.php

@ -3,7 +3,7 @@
@section('main')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="col-md-12">
<div class="card">
@include('inc.navbar')
<div class="card-header"><a href="/home">Home</a> -> {{ __('Yeast List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div>

3
routes/web.php

@ -30,9 +30,9 @@ Route::resource('yeasts', 'App\Http\Controllers\YeastController');
Route::resource('adjuncts', 'App\Http\Controllers\AdjunctController');
Route::resource('grainbills', 'App\Http\Controllers\GrainbillController');
Route::resource('mashes', 'App\Http\Controllers\MasheController');
Route::resource('hopadditions', 'App\Http\Controllers\HopAdditionController');
Route::get('/home', [App\Http\Controllers\SummarieController::class, 'index'])->name('home');
Route::get('/fermentations', [App\Http\Controllers\FermentationController::class, 'index'])->name('fermentations');
Route::get('/hopadditions', [App\Http\Controllers\HopAdditionController::class, 'index'])->name('hopadditions');
Route::get('/adjunctadditions', [App\Http\Controllers\AdjunctAdditionController::class, 'index'])->name('adjunctadditions');
Route::get('/brewery/{breweryID}', [App\Http\Controllers\BreweryController::class, 'index'])->name('brewery');
Route::get('/beer/{beerID}', [App\Http\Controllers\BeerController::class, 'index'])->name('beer');
@ -40,6 +40,5 @@ Route::get('/grain/{grainID}', [App\Http\Controllers\GraincardController::class,
Route::get('/yeast/{yeastID}', [App\Http\Controllers\YeastcardController::class, 'index'])->name('yeast');
Route::get('/hop/{hopID}', [App\Http\Controllers\HopcardController::class, 'index'])->name('hop');
Route::get('/adjunct/{adjunctID}', [App\Http\Controllers\AdjunctcardController::class, 'index'])->name('adjunct');
Route::post('/hopadditions', [App\Http\Controllers\HopAdditionController::class, 'store'])->name('hopadditions.store');
Route::post('/adjunctadditions', [App\Http\Controllers\AdjunctAdditionController::class, 'store'])->name('adjunctadditions.store');
Route::post('/fermentations', [App\Http\Controllers\FermentationController::class, 'store'])->name('fermentations.store');
Loading…
Cancel
Save