Browse Source

first iteration of search functionality - likely to fail hard

master
jk 3 years ago
parent
commit
7059fd103a
  1. 7
      app/Http/Controllers/SearchController.php

7
app/Http/Controllers/SearchController.php

@ -46,7 +46,12 @@ class SearchController extends Controller
$grainarr = array();
foreach ($grains as $grain){
$grainname = Grain::where('id', $grain->grain_id)->value('name');
array_push($grainarr, array('id'=>$grain->grain_id, 'name'=>$grainname));
if ($i == 0){
$grainarr[]= array('id'=>$grain->grain_id, 'name'=>$grainname);
} else {
array_push($grainarr, array('id'=>$grain->grain_id, 'name'=>$grainname));
};
$i++;
};
$result['grains'] = $grainarr;
$yeasts = Fermentation::where('beer_id', $result->beer_id)->distinct('yeast_id');

Loading…
Cancel
Save