diff options
| author | horus | 2019-05-27 16:16:10 +0200 |
|---|---|---|
| committer | horus | 2019-05-27 16:16:10 +0200 |
| commit | 37eaa9a1fffab43c1c46a27e68373f47f70eac31 (patch) | |
| tree | 6653713b65cc815d1e35c98e69af3fbf4b5966f2 /app | |
| parent | 01441be5513767e05c9fe9c3a37dce2ec32fb05e (diff) | |
| download | kategorischeraperitif-37eaa9a1fffab43c1c46a27e68373f47f70eac31.tar.gz | |
Much cleaner SearchController.
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' ); |
