|
@@ -26,7 +26,7 @@ class Film extends Eloquent {
|
|
public function scopeMeistgewunschteVorschlage($query) {
|
|
public function scopeMeistgewunschteVorschlage($query) {
|
|
$nextfilm = Dumbo::find(1)->film;
|
|
$nextfilm = Dumbo::find(1)->film;
|
|
return $query
|
|
return $query
|
|
- ->addSelect(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes'))
|
|
|
|
|
|
+ ->addSelect(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes, COUNT(*) as votes'))
|
|
->leftJoin('votes', 'votes.film', '=', 'films.id')
|
|
->leftJoin('votes', 'votes.film', '=', 'films.id')
|
|
->leftJoin('users', 'users.id', '=', 'votes.user')
|
|
->leftJoin('users', 'users.id', '=', 'votes.user')
|
|
->whereNull('gesehen')
|
|
->whereNull('gesehen')
|
|
@@ -60,4 +60,4 @@ class Film extends Eloquent {
|
|
return $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
|
return $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
|
}
|
|
}
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|