2013-07-25 23:33:04 +02:00
|
|
|
<?php
|
|
|
|
|
2013-07-28 19:45:21 +02:00
|
|
|
use Entities\Playlist;
|
|
|
|
use Illuminate\Support\Facades\Redirect;
|
|
|
|
|
2013-07-25 23:33:04 +02:00
|
|
|
class PlaylistsController extends Controller {
|
|
|
|
public function getIndex() {
|
|
|
|
return View::make('playlists.index');
|
|
|
|
}
|
2013-07-28 19:45:21 +02:00
|
|
|
|
|
|
|
public function getPlaylist($id, $slug) {
|
|
|
|
$playlist = Playlist::find($id);
|
|
|
|
if (!$playlist || !$playlist->canView(Auth::user()))
|
|
|
|
App::abort(404);
|
|
|
|
|
|
|
|
if ($playlist->slug != $slug)
|
|
|
|
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
|
|
|
|
|
|
|
return View::make('playlists.show');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getShortlink($id) {
|
|
|
|
$playlist = Playlist::find($id);
|
|
|
|
if (!$playlist || !$playlist->canView(Auth::user()))
|
|
|
|
App::abort(404);
|
|
|
|
|
|
|
|
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
|
|
|
}
|
2013-07-25 23:33:04 +02:00
|
|
|
}
|