Browse Source

adding dropdown menus to hopadditions create blade, mkI

master
jk 3 years ago
parent
commit
feebb801d9
  1. 5
      app/Http/Controllers/HopAdditionController.php
  2. 12
      resources/views/hopadditions/create.blade.php

5
app/Http/Controllers/HopAdditionController.php

@ -72,7 +72,10 @@ class HopAdditionController extends Controller
}
public function create()
{
return view('hopadditions.create');
$beers = Summarie::orderBy('name')->get();
$hops = Hop::orderBy('name')->get();
$data = array('beers'=>$beers, 'hops'=>$hops);
return view('hopadditions.create')->with($data);
}
public function destroy($id)
{

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

@ -18,11 +18,19 @@
@csrf
<div class="form-group">
<label for="beer_id">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
<select>
@foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="hop_id">Hop ID</label>
<input type="text" class="form-control" name="hop_id" >
<select>
@foreach ($hops as $hop)
<option name="hop_id" value="{{$hop->id}}">{{$hop->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="amount">Amount</label>

Loading…
Cancel
Save