This commit is contained in:
2013-09-08 02:08:27 +02:00
parent 6d715e4090
commit 5cb555e869
15 changed files with 1358 additions and 5 deletions

View File

@@ -13,5 +13,58 @@
Route::get('/', function()
{
return View::make('hello');
});
$gesehen = Film::zuletztGesehen()->get();
$vorgeschlagen = Film::neuesteVorschlage()->get();
return View::make('index')
->with('gesehen', $gesehen)
->with('vorgeschlagen', $vorgeschlagen);
});
Route::get('film/{id}', array('as' => 'film', function($id) {
$film = Film::findOrFail($id);
$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
$tmovie = $tmdb->getMovie($film->tvdbid);
$tcast = $tmdb->getMovieCast($film->tvdbid);
$ttrail = $tmdb->getMovieTrailers($film->tvdbid);
$image = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
$votes = $film->votes()->count();
$vposi = $film->votes()->where('stimme', true)->count();
$comments = $film->comments()->orderBy('id', 'DESC')->get();
return View::make('film')
->with('film', $film)
->with('tfilm', $tmovie)
->with('poster', $image)
->with('comments', $comments)
->with('cast', $tcast)
->with('trail', $ttrail)
->with('votes', $votes)
->with('vposi', $vposi)
->with('tmdb', $tmdb);
}));
Route::get('login', array('as' => 'login', function() {
return View::make('login');
}));
Route::post('login', function() {
$userdata = array(
'name' => Input::get('iSpieler'),
'password' => Input::get('iPassword'));
if(Auth::attempt($userdata)) {
return Redirect::intended('/');
} else {
echo "Login gescheitert.";
var_dump($userdata);
return Redirect::to('login')
->with('login_errors', true);
}
});
Route::get('logout', array('as' => 'logout', function() {
Auth::logout();
return Redirect::to('/');
}));