Browse Source

first iteration of search functionality - likely to fail hard

master
jk 3 years ago
parent
commit
543186c84c
  1. 4
      app/Http/Controllers/SearchController.php

4
app/Http/Controllers/SearchController.php

@ -45,8 +45,8 @@ class SearchController extends Controller
$grains = Grainbill::where('beer_id', $result->beer_id)->pluck('grain_id'); $grains = Grainbill::where('beer_id', $result->beer_id)->pluck('grain_id');
$grainarr = array(); $grainarr = array();
foreach ($grains as $grain){ foreach ($grains as $grain){
$grainname = Grain::where('id', $grain->id)->value('name');
array_push($grainarr, array('id'=>$grain->id, 'name'=>$grainname));
$grainname = Grain::where('id', $grain->grain_id)->value('name');
array_push($grainarr, array('id'=>$grain->grain_id, 'name'=>$grainname));
}; };
$result['grains'] = $grainarr; $result['grains'] = $grainarr;
$yeasts = Fermentation::where('beer_id', $result->beer_id)->distinct('yeast_id'); $yeasts = Fermentation::where('beer_id', $result->beer_id)->distinct('yeast_id');

Loading…
Cancel
Save