Browse Source

adding dropdown menus to grainbill create blade, mkII

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

2
app/Http/Controllers/GrainbillController.php

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

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

@ -20,7 +20,7 @@
<label for="beer_id">Beer ID</label> <label for="beer_id">Beer ID</label>
<select> <select>
@foreach ($beers as $beer) @foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->id}}">{{$beer->name}} (ID: {{$beer->id}})</option>
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}} (ID: {{$beer->beer_id}})</option>
@endforeach @endforeach
</select> </select>
</div> </div>

Loading…
Cancel
Save