From 1bc19e229bb58c8aa3295ea8cce12dfcc81fa6d2 Mon Sep 17 00:00:00 2001 From: jk Date: Thu, 24 Jun 2021 15:28:51 +0100 Subject: [PATCH] first iteration of search functionality - likely to fail hard --- app/Http/Controllers/SearchController.php | 4 ++-- resources/views/search/results.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 8b655c5..dfe565d 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -47,9 +47,9 @@ class SearchController extends Controller foreach ($grains as $grain){ $grainname = Grain::where('id', $grain->grain_id)->value('name'); if ($i == 0){ - $grainarr[]= array('id'=>$grain->grain_id, 'name'=>$grainname); + $grainarr[]= array('id'=>$grain->grain_id, 'name'=>$grainname, 'amount'=>$grain->amount, 'grain_bill'=>$grain->grain_bill); } else { - array_push($grainarr, array('id'=>$grain->grain_id, 'name'=>$grainname)); + array_push($grainarr, array('id'=>$grain->grain_id, 'name'=>$grainname, 'amount'=>$grain->amount, 'grain_bill'=>$grain->grain_bill)); }; $i++; }; diff --git a/resources/views/search/results.blade.php b/resources/views/search/results.blade.php index 7b1b730..6767036 100644 --- a/resources/views/search/results.blade.php +++ b/resources/views/search/results.blade.php @@ -88,7 +88,7 @@ @foreach ($results as $result) {{$result->name}} - @foreach($result->grains as $grain){{$grain['name']}}
@endforeach + @foreach($result->grains as $grain){{$grain['name']}} {{grain['amount']}}({{grain['grain_bill']}}%)
@endforeach Hops Yeasts Asjuncts