Browse Source

adding dropdown menus to fermentations create blade, mkI

master
jk 3 years ago
parent
commit
41510433b5
  1. 5
      app/Http/Controllers/FermentationController.php
  2. 16
      resources/views/fermentations/create.blade.php
  3. 4
      resources/views/grainbills/create.blade.php
  4. 4
      resources/views/hopadditions/create.blade.php
  5. 2
      resources/views/mashes/create.blade.php

5
app/Http/Controllers/FermentationController.php

@ -82,7 +82,10 @@ class FermentationController extends Controller
} }
public function create() public function create()
{ {
return view('fermentations.create');
$beers = Summarie::orderBy('name')->get();
$yeasts = Yeast::orderBy('name')->get();
$data = array('beers'=>$beers, 'yeasts'=>$yeasts);
return view('fermentations.create')->with($data);
} }
public function destroy($id) public function destroy($id)
{ {

16
resources/views/fermentations/create.blade.php

@ -17,12 +17,20 @@
<form method="post" action="{{ route('fermentations.store') }}"> <form method="post" action="{{ route('fermentations.store') }}">
@csrf @csrf
<div class="form-group"> <div class="form-group">
<label for="beer_id">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
<label for="beer_id">Beer</label>
<select>
@foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>
@endforeach
</select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="yeast_id">Yeast ID</label>
<input type="text" class="form-control" name="yeast_id" >
<label for="yeast_id">Yeast</label>
<select>
@foreach ($yeasts as $yeast)
<option name="yeast_id" value="{{$yeast->id}}">{{$yeast->name}}</option>
@endforeach
</select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="temperature">Temperature</label> <label for="temperature">Temperature</label>

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

@ -17,7 +17,7 @@
<form method="post" action="{{ route('grainbills.store') }}"> <form method="post" action="{{ route('grainbills.store') }}">
@csrf @csrf
<div class="form-group"> <div class="form-group">
<label for="beer_id">Beer ID</label>
<label for="beer_id">Beer</label>
<select> <select>
@foreach ($beers as $beer) @foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option> <option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>
@ -25,7 +25,7 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="grain_id">Grain ID</label>
<label for="grain_id">Grain</label>
<select> <select>
@foreach ($grains as $grain) @foreach ($grains as $grain)
<option name="grain_id" value="{{$grain->id}}">{{$grain->name}}</option> <option name="grain_id" value="{{$grain->id}}">{{$grain->name}}</option>

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

@ -17,7 +17,7 @@
<form method="post" action="{{ route('hopadditions.store') }}"> <form method="post" action="{{ route('hopadditions.store') }}">
@csrf @csrf
<div class="form-group"> <div class="form-group">
<label for="beer_id">Beer ID</label>
<label for="beer_id">Beer</label>
<select> <select>
@foreach ($beers as $beer) @foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option> <option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>
@ -25,7 +25,7 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="hop_id">Hop ID</label>
<label for="hop_id">Hop</label>
<select> <select>
@foreach ($hops as $hop) @foreach ($hops as $hop)
<option name="hop_id" value="{{$hop->id}}">{{$hop->name}}</option> <option name="hop_id" value="{{$hop->id}}">{{$hop->name}}</option>

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

@ -17,7 +17,7 @@
<form method="post" action="{{ route('mashes.store') }}"> <form method="post" action="{{ route('mashes.store') }}">
@csrf @csrf
<div class="form-group"> <div class="form-group">
<label for="beer_id">Beer ID</label>
<label for="beer_id">Beer</label>
<select> <select>
@foreach ($beers as $beer) @foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option> <option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>

Loading…
Cancel
Save