Neues Update
This commit is contained in:
@@ -16,6 +16,7 @@ Route::get('/', function()
|
||||
$gesehen = Film::zuletztGesehen()->get();
|
||||
$vorgeschlagen = Film::neuesteVorschlage()->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,
|
||||
@@ -23,6 +24,7 @@ Route::get('/', function()
|
||||
COUNT(case when film_votes.stimme IS TRUE then 1 end) - COUNT(case when film_votes.stimme IS FALSE 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();
|
||||
@@ -31,11 +33,23 @@ Route::get('/', function()
|
||||
$tmovie = $tmdb->getMovie($topfilm->tvdbid);
|
||||
$image = $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');
|
||||
} else {
|
||||
$nimage = "http://d3a8mw37cqal2z.cloudfront.net/assets/7ea4ac6f271e37d/images/no-poster-w130.jpg";
|
||||
}
|
||||
|
||||
$kommentare = Comment::neueste()->get();
|
||||
|
||||
return View::make('index')
|
||||
->with('gesehen', $gesehen)
|
||||
->with('vorgeschlagen', $vorgeschlagen)
|
||||
->with('image', $image)
|
||||
->with('nimage', $nimage)
|
||||
->with('news', $news)
|
||||
->with('kommentare', $kommentare)
|
||||
->with('nextfilm', $nextfilm)
|
||||
->with('topfilm', $topfilm);
|
||||
});
|
||||
|
||||
@@ -201,9 +215,21 @@ Route::get('mark-read/{id}', array('before' => 'auth', function($id) {
|
||||
$film = Film::findOrFail($id);
|
||||
$film->gesehen = \Carbon\Carbon::today();
|
||||
$film->save();
|
||||
if(Dumbo::find(1)->nextfilm == $film->id) {
|
||||
$system = Dumbo::findOrFail(1);
|
||||
$system->nextfilm = 0;
|
||||
$system->save();
|
||||
}
|
||||
return Redirect::to('film/' . $film->id);
|
||||
}));
|
||||
|
||||
Route::get('view-next/{id}', array('before' => 'auth', function($id) {
|
||||
$system = Dumbo::findOrFail(1);
|
||||
$system->nextfilm = $id;
|
||||
$system->save();
|
||||
return Redirect::to('film/' . $id);
|
||||
}));
|
||||
|
||||
Route::get('register', function() {
|
||||
return View::make('register');
|
||||
});
|
||||
|
Reference in New Issue
Block a user