Browse Source

reverting edit drop downs for breweries

master
jk 3 years ago
parent
commit
75a1b7d4ca
  1. 5
      app/Http/Controllers/BrewerieController.php
  2. 10
      resources/views/breweries/edit.blade.php

5
app/Http/Controllers/BrewerieController.php

@ -45,10 +45,7 @@ class BrewerieController extends Controller
public function edit($id){
$brewery = Brewerie::where('id', (int)$id)->first();
$breweries = Brewerie::orderBy('name')->get();
$selected_brewery = $brewery->id;
$data = array('brewery'=>$brewery, 'breweries'=>$breweries, 'selected_brewery'=>$selected_brewery);
return view('breweries.edit')->with($data);
return view('breweries.edit')->with('brewery', $brewery);
}
public function update(Request $request, $id)

10
resources/views/breweries/edit.blade.php

@ -19,21 +19,17 @@
<div class="form-group">
<label for="name">Name</label>
<select class="form-control" name="brewery_id">
@foreach ($breweries as $brewer)
<option value="{{$brewer->id}}" {{ $selected_brewery == $brewer->id ? 'selected="selected"' : '' }}>{{$brewer->name}}</option>
@endforeach
</select>
<input type="text" class="form-control" name="name" value="{{ $brewery->name }}" />
</div>
<div class="form-group">
<label for="place">City/Region</label>
<input type="text" class="form-control" name="place" value={{ $brewery->place }} />
<input type="text" class="form-control" name="place" value="{{ $brewery->place }}" />
</div>
<div class="form-group">
<label for="country">Country</label>
<input type="text" class="form-control" name="country" value={{ $brewery->country }} />
<input type="text" class="form-control" name="country" value="{{ $brewery->country }}" />
<input type="hidden" name="breweryid" id="breweryid" value={{ $brewery->id }} />
</div>
<button type="submit" class="btn btn-primary">Update</button>

Loading…
Cancel
Save