From 059e4f0c1f7f167bc66f9db2198ab6bb82bed5a0 Mon Sep 17 00:00:00 2001 From: jk Date: Thu, 24 Jun 2021 14:48:09 +0100 Subject: [PATCH] first iteration of search functionality - likely to fail hard --- app/Http/Controllers/SearchController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 5c20f7f..3d1b09e 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -48,7 +48,12 @@ class SearchController extends Controller foreach ($grains as $grain){ $grainname = Grain::where('id', $grain->id)->value('name'); $grainarr = array('id'=>$grain->id, 'name'=>$grainname); - array_push($result['grains'],$grainarr); + if ($i == 0) { + $result['grains'] = $grainarr; + } else { + array_push($result['grains'],$grainarr); + } + $i++; }; $yeasts = Fermentation::where('beer_id', $result->beer_id)->distinct('yeast_id'); $result['yeasts']=[];