diff options
Diffstat (limited to 'site/app')
| -rw-r--r-- | site/app/Http/Controllers/PageFeedController.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/site/app/Http/Controllers/PageFeedController.php b/site/app/Http/Controllers/PageFeedController.php index e29c8ca..ee4f3ec 100644 --- a/site/app/Http/Controllers/PageFeedController.php +++ b/site/app/Http/Controllers/PageFeedController.php @@ -15,19 +15,22 @@ class PageFeedController extends Controller { public function showPage(Request $request) { - $views = array("whisky", "wodka", "gin", "rum", "misc", "all"); + $views = array("whisky", "wodka", "gin", "rum", "misc"); $query = ""; foreach($views as $view) { if ($query != "") { $query .= " UNION "; } - $query .= "(SELECT name, image_url, spirit_type, spirit_type AS url, spirit_type AS feedname, '' AS linktext, created_at FROM ". $view ."_view WHERE original_price > 19.98 ORDER BY created_at DESC LIMIT 1)"; + $query .= "(SELECT spirit_type as name, image_url, spirit_type, spirit_type AS url, spirit_type AS feedname, '' AS linktext FROM ". $view ."_view WHERE original_price > 19.98 ORDER BY created_at DESC LIMIT 1)"; } - # todo: schlägt manchmal fehl - $query .= " UNION (SELECT name, image_url, spirit_type, spirit_type AS url, spirit_type AS feedname, '' AS linktext, created_at FROM ". $view ."_view WHERE original_price > 19.98 AND (procent < (SELECT MAX(procent) FROM all_view)) ORDER BY procent LIMIT 1)"; + + # query mit festen parametern + $query .= " UNION (SELECT 'Alle Angebote' as name, '/img/paw-400-400.png' as image_url, 'Alle Angebote' as spirit_type, 'all' AS url, 'Feed aller Angebote' AS feedname, 'Zum Feed aller Angebote' AS linktext FROM all_view LIMIT 1)"; $data = DB::select($query); + + array_push($views, "alle angebote"); return view('feeds', ['data' => $data, 'views' => $views]); } |
