mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Adding two of the mobile endpoints back, hopefully the data matches
This commit is contained in:
parent
3815016f3c
commit
1b6032e9e3
2 changed files with 48 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);
|
||||
}
|
||||
}
|
|
@ -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