Browse Source

first iteration of search functionality - likely to fail hard

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

4
app/Http/Controllers/SearchController.php

@ -43,12 +43,12 @@ class SearchController extends Controller
$i++; $i++;
}; };
$grains = Grainbill::where('beer_id', $result->beer_id)->distinct('grain_id'); $grains = Grainbill::where('beer_id', $result->beer_id)->distinct('grain_id');
$result['grains']=[];
$result['grains']=array();
$i = 0; $i = 0;
foreach ($grains as $grain){ foreach ($grains as $grain){
$grainname = Grain::where('id', $grain->id)->value('name'); $grainname = Grain::where('id', $grain->id)->value('name');
$grainarr = array('id'=>$grain->id, 'name'=>$grainname); $grainarr = array('id'=>$grain->id, 'name'=>$grainname);
$result['grains'][$i] = $grainarr;
$result['grains'][] = $grainarr;
$i++; $i++;
}; };
$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