From d1266d01d3b5cf8870437bcc8956e1edbcd55b3b Mon Sep 17 00:00:00 2001 From: jk Date: Thu, 24 Jun 2021 15:53:27 +0100 Subject: [PATCH] first iteration of search functionality - likely to fail hard --- app/Http/Controllers/SearchController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 8371fd7..85a54b8 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -33,7 +33,7 @@ class SearchController extends Controller foreach ($results as $result) { $brewery = Brewerie::where('id', $result->brewery_id)->value('name'); $result['brewery']=$brewery; - $hops = Hopaddition::where('beer_id', $result->beer_id)->unique('hop_id'); + $hops = Hopaddition::where('beer_id', $result->beer_id)->distinct('hop_id')->get(); $hoparr=array(); $i = 0; foreach ($hops as $hop){ @@ -59,7 +59,7 @@ class SearchController extends Controller $i++; }; $result['grains'] = $grainarr; - $yeasts = Fermentation::where('beer_id', $result->beer_id)->value('yeast_id'); + $yeasts = Fermentation::where('beer_id', $result->beer_id)->distinct('yeast_id')->get(); $yeastarr=array(); $i = 0; foreach ($yeasts as $yeast){ @@ -72,7 +72,7 @@ class SearchController extends Controller $i++; }; $result['yeasts']=$yeastarr; - $adjuncts = Adjunctaddition::where('beer_id', $result->beer_id)->distinct('adjunct_id'); + $adjuncts = Adjunctaddition::where('beer_id', $result->beer_id)->distinct('adjunct_id')->get(); $adjunctarr = array(); $i = 0; foreach ($adjuncts as $adjunct){