diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/Http/Controllers/SearchController.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 9efc391..157e0d4 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -58,20 +58,27 @@ class SearchController extends Controller { } } + $title = "Die Suche nach dem Nirwana"; + $query = "nichts"; + + $data = DB::table('all_view'); if ( "" != Input::get('type') ) { $query = Input::get('type'); - $data = DB::table('all_view')->where('spirit_type', '=', Input::get('type'))->whereNotNull('url')->orderBy($sort_by, $order_by)->paginate(20); - $count = DB::table('all_view')->where('spirit_type', '=', Input::get('type'))->whereNotNull('url')->count(); - + $data = $data->where('spirit_type', '=', Input::get('type')); $title = "Suche nach " . ucwords(Input::get('type')); - } else { + } + if ( "" != Input::get('q') ) { $query = Input::get("q"); $q = "%" . Utility::escapeLike($query) . "%"; - $data = DB::table('all_view')->whereNotNull('url')->where('name', 'like', $q)->orWhere('spirit_type', 'like', $q)->orWhere('shop', 'like', $q)->orderBy($sort_by, $order_by)->paginate(20); - $count = DB::table('all_view')->whereNotNull('url')->where('name', 'like', $q)->orWhere('spirit_type', 'like', $q)->orWhere('shop', 'like', $q)->count(); - + $data = $data->where('name', 'like', $q)->orWhere('spirit_type', 'like', $q)->orWhere('shop', 'like', $q); $title = "Suche nach " . ucwords(Input::get('q')); - } + } + + $data = $data->whereNotNull('url'); + $count= $data->count(); + + $data = $data->orderBy($sort_by, $order_by)->paginate(20); + $spirit_types = DB::select('SELECT DISTINCT spirit_type FROM all_view ORDER BY spirit_type' ); |
