Browse Source

first iteration of search functionality - likely to fail hard

master
jk 3 years ago
parent
commit
cd22855827
  1. 4
      app/Http/Controllers/SearchController.php

4
app/Http/Controllers/SearchController.php

@ -30,7 +30,7 @@ class SearchController extends Controller
switch($table) { switch($table) {
case('summarie'): 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) { foreach ($results as $result) {
$brewery = Brewerie::where('id', $result->brewery_id)->value('name'); $brewery = Brewerie::where('id', $result->brewery_id)->value('name');
$result['brewery']=$brewery; $result['brewery']=$brewery;
@ -84,8 +84,6 @@ class SearchController extends Controller
default: default:
$msg = "You fucked up somehow!"; $msg = "You fucked up somehow!";
} }
$result = $results[0];
$results = $result->sortable('name')->paginate(10);
return('search.results')->with($results); return('search.results')->with($results);
} }
} }
Loading…
Cancel
Save