From cd2285582792a67b7a7cdc31ff2108f30eeccccb Mon Sep 17 00:00:00 2001 From: jk Date: Thu, 24 Jun 2021 10:57:53 +0100 Subject: [PATCH] first iteration of search functionality - likely to fail hard --- app/Http/Controllers/SearchController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 2571688..bcf33cd 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -30,7 +30,7 @@ class SearchController extends Controller switch($table) { case('summarie'): - $results = Summarie::where('keywords', 'LIKE', '%'.$search.'%')->orWhere('type', 'LIKE', '%'.$search.'%')->get(); + $results = Summarie::where('keywords', 'LIKE', '%'.$search.'%')->orWhere('type', 'LIKE', '%'.$search.'%')->sortable()->paginate(10)->get(); foreach ($results as $result) { $brewery = Brewerie::where('id', $result->brewery_id)->value('name'); $result['brewery']=$brewery; @@ -84,8 +84,6 @@ class SearchController extends Controller default: $msg = "You fucked up somehow!"; } - $result = $results[0]; - $results = $result->sortable('name')->paginate(10); return('search.results')->with($results); } }