Merge branch 'development'

This commit is contained in:
Adam Lavin 2013-11-28 13:33:07 +00:00
commit 2d5eb9f1cd
3 changed files with 49 additions and 1 deletions

View file

@ -0,0 +1,40 @@
<?php namespace Api\Mobile;
use Entities\Track;
class TracksController extends Controller
{
public function latest()
{
$tracks = Track::summary()
->userDetails()
->listed()
->explicitFilter()
->published()
->with('user', 'genre', 'cover', 'album', 'album.user')->take(10);
$json = [
'total_tracks' => $tracks->count(),
'tracks' => $tracks->toArray()
];
return Response::json($json, 200);
}
public function popular()
{
$tracks = Track::popular(10)
->userDetails()
->listed()
->explicitFilter()
->published()
->with('user', 'genre', 'cover', 'album', 'album.user')->take(10);
$json = [
'total_tracks' => $tracks->count(),
'tracks' => $tracks->toArray()
];
return Response::json($json, 200);
}
}

View file

@ -7,6 +7,7 @@
public function __construct() {
$this->poniverse = new Poniverse(Config::get('poniverse.client_id'), Config::get('poniverse.secret'));
$this->poniverse->setRedirectUri(URL::to('/auth/oauth'));
}
public function getLogin() {

View file

@ -151,4 +151,11 @@
Route::get('{slug}/content', 'ArtistsController@getProfile');
Route::get('{slug}/favourites', 'ArtistsController@getProfile');
Route::get('/', 'HomeController@getIndex');
Route::get('/', 'HomeController@getIndex');
Route::group(['domain' => 'api.pony.fm'], function() {
Route::get('tracks/latest', ['uses' => 'Api\Mobile\TracksController@latest']);
Route::get('tracks/popular', [ 'uses' => 'Api\Mobile\TracksController@popular']);
/* Route::get('tracks/id', [ 'uses' => 'Api\Mobile\TracksController@track']);
Route::get('user', ['uses' => 'Api\Mobile\UserController@user']);*/
});