mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Merge branch 'development'
This commit is contained in:
commit
2d5eb9f1cd
3 changed files with 49 additions and 1 deletions
40
app/controllers/Api/Mobile/TracksController.php
Normal file
40
app/controllers/Api/Mobile/TracksController.php
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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() {
|
||||
|
|
|
@ -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']);*/
|
||||
});
|
Loading…
Reference in a new issue