Browse Source

trying to fix dropdown menus, mkI

master
jk 3 years ago
parent
commit
37978caa1a
  1. 4
      app/Http/Controllers/SummarieController.php
  2. 11
      resources/views/beers/create.blade.php

4
app/Http/Controllers/SummarieController.php

@ -148,8 +148,8 @@ class SummarieController extends Controller
{ {
$lastID = Summarie::orderBy('beer_id','desc')->take(1)->value('beer_id'); $lastID = Summarie::orderBy('beer_id','desc')->take(1)->value('beer_id');
$beer_id = number_format($lastID) + 1; $beer_id = number_format($lastID) + 1;
$breweries = Brewerie::orderBy('name')->get();
$data = array('beer_id'=>$beer_id, 'breweries'=>$breweries);
$brewery_list = Brewerie::orderBy('name')->pluck('name', 'id');
$data = array('beer_id'=>$beer_id, 'brewery_list'=>$brewery_list);
return view('beers.create')->with($data); return view('beers.create')->with($data);
} }

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

@ -54,11 +54,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="brewery_id">Brewery</label> <label for="brewery_id">Brewery</label>
<select>
@foreach ($breweries as $brewery)
<option class="form-control" name="brewery_id" value="{{$brewery->id}}">{{$brewery->name}}</option>
@endforeach
</select>
#<select>
# @foreach ($breweries as $brewery)
# <option class="form-control" name="brewery_id" value="{{$brewery->id}}">{{$brewery->name}}</option>
# @endforeach
#</select>
{{ Form::select('brewery_id', $brewery_list) }}
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="batch">Batch Size (L)</label> <label for="batch">Batch Size (L)</label>

Loading…
Cancel
Save