2013-07-25 23:33:04 +02:00
|
|
|
<?php
|
|
|
|
|
2013-07-27 02:15:07 +02:00
|
|
|
use Entities\Track;
|
|
|
|
use Illuminate\Support\Facades\App;
|
|
|
|
|
2013-07-25 23:33:04 +02:00
|
|
|
class TracksController extends Controller {
|
|
|
|
public function getIndex() {
|
|
|
|
return View::make('tracks.index');
|
|
|
|
}
|
2013-08-01 01:04:04 +02:00
|
|
|
|
|
|
|
public function getTrack($id, $slug) {
|
|
|
|
$track = Track::find($id);
|
|
|
|
if (!$track || !$track->canView(Auth::user()))
|
|
|
|
App::abort(404);
|
|
|
|
|
|
|
|
if ($track->slug != $slug)
|
|
|
|
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
|
|
|
|
|
|
|
return View::make('tracks.show');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getShortlink($id) {
|
|
|
|
$track = Track::find($id);
|
|
|
|
if (!$track || !$track->canView(Auth::user()))
|
|
|
|
App::abort(404);
|
|
|
|
|
|
|
|
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
|
|
|
}
|
2013-07-25 23:33:04 +02:00
|
|
|
}
|