Browse Source

adding dropdown menus to grainbill create blade, mkI

master
jk 3 years ago
parent
commit
febe2cd653
  1. 5
      app/Http/Controllers/GrainbillController.php
  2. 12
      resources/views/grainbills/create.blade.php

5
app/Http/Controllers/GrainbillController.php

@ -74,7 +74,10 @@ class GrainbillController extends Controller
}
public function create()
{
return view('grainbills.create');
$beers = Summarie::orderBy('name')->get('id','name');
$grains = Grain::orderBy('name')->get('id','name');
$data = array('beers'=>$beers, 'grains'=>$grains);
return view('grainbills.create')->with($data);
}
public function destroy($id)
{

12
resources/views/grainbills/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->id}}">{{$beer->name}} (ID: {{$beer->id}})</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="grain_id">Grain ID</label>
<input type="text" class="form-control" name="grain_id" >
<select>
@foreach ($grains as $grain)
<option name="grain_id" value="{{$grain->id}}">{{$grain->name}} (ID: {{$grain->id}})</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="amount">Amount</label>

Loading…
Cancel
Save