|
@@ -21,7 +21,7 @@ Route::get('/', function()
|
|
|
$topfilm = DB::table(DB::raw('film_films'))
|
|
|
->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
|
|
|
COUNT(case when film_votes.stimme IS FALSE then 1 end) as downvotes,
|
|
|
- COUNT(case when film_votes.stimme IS TRUE then 1 end) - COUNT(case when film_votes.stimme IS FALSE then 1 end) as vcount'))
|
|
|
+ COUNT(case when film_votes.stimme IS TRUE then 1 end) as vcount'))
|
|
|
->leftJoin('votes', 'votes.film', '=', 'films.id')
|
|
|
->whereNull('films.gesehen')
|
|
|
->where('films.id', "!=", is_object($nextfilm) ? $nextfilm->id : 0)
|
|
@@ -64,14 +64,15 @@ Route::get('film/{id}', array('as' => 'film', function($id) {
|
|
|
|
|
|
$votes = $film->votes()->count();
|
|
|
$vposi = $film->votes()->where('stimme', true)->count();
|
|
|
- $pv = "";
|
|
|
+
|
|
|
+ $pv = array();
|
|
|
foreach($film->votes()->where('stimme', true)->get() as $v) {
|
|
|
- $pv .= $v->voter->name . "<br> ";
|
|
|
+ $pv[] = $v->voter->name;
|
|
|
}
|
|
|
|
|
|
- $nv = "";
|
|
|
+ $nv = array();
|
|
|
foreach($film->votes()->where('stimme', false)->get() as $v) {
|
|
|
- $nv .= $v->voter->name . "<br> ";
|
|
|
+ $nv[] = $v->voter->name;
|
|
|
}
|
|
|
|
|
|
if(!is_null(Auth::user()) && $film->votes()->where('user', Auth::user()->id)->count() > 0) {
|
|
@@ -161,25 +162,44 @@ Route::get('logout', array('as' => 'logout', function() {
|
|
|
return Redirect::to('/');
|
|
|
}));
|
|
|
|
|
|
-Route::get('vorgeschlagen', function() {
|
|
|
+Route::get('beliebt', function() {
|
|
|
|
|
|
$filme = DB::table(DB::raw('film_films'))
|
|
|
->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
|
|
|
COUNT(case when film_votes.stimme IS FALSE then 1 end) as downvotes,
|
|
|
- COUNT(case when film_votes.stimme IS TRUE then 1 end) - COUNT(case when film_votes.stimme IS FALSE then 1 end) as vcount'))
|
|
|
+ COUNT(case when film_votes.stimme IS TRUE then 1 end) as vcount'))
|
|
|
->leftJoin('votes', 'votes.film', '=', 'films.id')
|
|
|
->whereNull('films.gesehen')
|
|
|
->groupBy('id')
|
|
|
->orderBy('vcount', 'DESC')->orderBy('vorgeschlagen', 'ASC')
|
|
|
- ->paginate();
|
|
|
+ ->paginate(25);
|
|
|
|
|
|
return View::make('suggest')
|
|
|
- ->with('filme', $filme);
|
|
|
+ ->with('filme', $filme)
|
|
|
+ ->with('titel', 'Vorschläge nach Wertung');
|
|
|
|
|
|
-})->where(array('field' => '[a-z]+', 'order' => 'asc|desc'));
|
|
|
+});
|
|
|
+
|
|
|
+Route::get('vorgeschlagen', function() {
|
|
|
+
|
|
|
+ $filme = DB::table(DB::raw('film_films'))
|
|
|
+ ->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
|
|
|
+ COUNT(case when film_votes.stimme IS FALSE then 1 end) as downvotes,
|
|
|
+ COUNT(case when film_votes.stimme IS TRUE then 1 end) as vcount'))
|
|
|
+ ->leftJoin('votes', 'votes.film', '=', 'films.id')
|
|
|
+ ->whereNull('films.gesehen')
|
|
|
+ ->groupBy('id')
|
|
|
+ ->orderBy('vorgeschlagen', 'DESC')
|
|
|
+ ->paginate(25);
|
|
|
+
|
|
|
+ return View::make('suggest')
|
|
|
+ ->with('filme', $filme)
|
|
|
+ ->with('titel', 'Vorschläge nach Datum');
|
|
|
+
|
|
|
+});
|
|
|
|
|
|
Route::get('gesehen/{field?}/{order?}', function($field = "gesehen", $order = "desc") {
|
|
|
- $filme = Film::whereNotNull('gesehen')->orderBy($field, $order)->paginate();
|
|
|
+ $filme = Film::whereNotNull('gesehen')->orderBy($field, $order)->paginate(25);
|
|
|
|
|
|
return View::make('seen')
|
|
|
->with('filme', $filme);
|