Sommer Style, Avatare, Duplikate
This commit is contained in:
@@ -11,46 +11,43 @@
|
||||
|
|
||||
*/
|
||||
|
||||
define('TMDB_API_KEY', 'b187f8d9c5e72b1faecb741d5d04239a');
|
||||
|
||||
Route::get('/', function()
|
||||
{
|
||||
$gesehen = Film::zuletztGesehen()->get();
|
||||
$vorgeschlagen = Film::neuesteVorschlage()->get();
|
||||
$mg = Film::meistgewunschteVorschlage()->get();
|
||||
|
||||
$news = News::aktuell()->get();
|
||||
$nextfilm = Dumbo::find(1)->film;
|
||||
|
||||
$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) as vcount'))
|
||||
->leftJoin('votes', 'votes.film', '=', 'films.id')
|
||||
->whereNull('films.gesehen')
|
||||
->where('films.id', "!=", is_object($nextfilm) ? $nextfilm->id : 0)
|
||||
->groupBy('id')
|
||||
->orderBy('vcount', 'DESC')->orderBy('vorgeschlagen', 'ASC')
|
||||
->first();
|
||||
|
||||
$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
|
||||
$tmovie = $tmdb->getMovie($topfilm->tvdbid);
|
||||
$image = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
||||
$tmdb = new TMDb(TMDB_API_KEY, 'de', TRUE);
|
||||
foreach(array("top" => $mg[0], "neu" => $vorgeschlagen[0], "alt" => $gesehen[0]) as $key => $val) {
|
||||
$tmovie = $tmdb->getMovie($val->tvdbid);
|
||||
$images[$key] = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
||||
}
|
||||
|
||||
if(is_object($nextfilm)) {
|
||||
$tmovie = $tmdb->getMovie($nextfilm->tvdbid);
|
||||
$nimage = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
||||
$images["next"] = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
|
||||
} else {
|
||||
$nimage = "img/no-poster-w92.jpg";
|
||||
$images["next"] = "img/no-poster-w92.jpg";
|
||||
}
|
||||
|
||||
$kommentare = Comment::neueste()->get();
|
||||
|
||||
return View::make('index')
|
||||
$labels = array("", "danger", "danger", "warning", "warning", "info", "info", "primary", "primary", "success", "success");
|
||||
|
||||
return View::make('index')
|
||||
->with('gesehen', $gesehen)
|
||||
->with('vorgeschlagen', $vorgeschlagen)
|
||||
->with('image', $image)
|
||||
->with('nimage', $nimage)
|
||||
->with('meistgw', $mg)
|
||||
->with('images', $images)
|
||||
->with('news', $news)
|
||||
->with('kommentare', $kommentare)
|
||||
->with('nextfilm', $nextfilm)
|
||||
->with('topfilm', $topfilm);
|
||||
->with('labels', $labels)
|
||||
->with('nextfilm', $nextfilm);
|
||||
});
|
||||
|
||||
Route::get('film/{id}', array('as' => 'film', function($id) {
|
||||
@@ -67,12 +64,12 @@ Route::get('film/{id}', array('as' => 'film', function($id) {
|
||||
|
||||
$pv = array();
|
||||
foreach($film->votes()->where('stimme', true)->get() as $v) {
|
||||
$pv[] = $v->voter->name;
|
||||
$pv[] = $v->voter;
|
||||
}
|
||||
|
||||
$nv = array();
|
||||
foreach($film->votes()->where('stimme', false)->get() as $v) {
|
||||
$nv[] = $v->voter->name;
|
||||
$nv[] = $v->voter;
|
||||
}
|
||||
|
||||
if(!is_null(Auth::user()) && $film->votes()->where('user', Auth::user()->id)->count() > 0) {
|
||||
|
Reference in New Issue
Block a user