mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
before mass replace
This commit is contained in:
parent
dff20dbf3b
commit
8d834f41db
2 changed files with 14 additions and 11 deletions
|
@ -6,6 +6,9 @@
|
||||||
use Commands\EditTrackCommand;
|
use Commands\EditTrackCommand;
|
||||||
use Commands\UploadTrackCommand;
|
use Commands\UploadTrackCommand;
|
||||||
use Entities\Track;
|
use Entities\Track;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
use Illuminate\Support\Facades\Response;
|
||||||
|
|
||||||
class TracksController extends \ApiControllerBase {
|
class TracksController extends \ApiControllerBase {
|
||||||
public function postUpload() {
|
public function postUpload() {
|
||||||
|
@ -16,7 +19,7 @@
|
||||||
public function getOwned() {
|
public function getOwned() {
|
||||||
$query = Track::summary()->whereNull('deleted_at')->where('user_id', \Auth::user()->id);
|
$query = Track::summary()->whereNull('deleted_at')->where('user_id', \Auth::user()->id);
|
||||||
|
|
||||||
if (\Input::has('published')) {
|
if (Input::has('published')) {
|
||||||
$published = \Input::get('published');
|
$published = \Input::get('published');
|
||||||
if ($published)
|
if ($published)
|
||||||
$query->whereNotNull('published_at');
|
$query->whereNotNull('published_at');
|
||||||
|
@ -24,17 +27,17 @@
|
||||||
$query->whereNull('published_at');
|
$query->whereNull('published_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\Input::has('order')) {
|
if (Input::has('order')) {
|
||||||
$order = \Input::get('order');
|
$order = \Input::get('order');
|
||||||
$parts = explode(',', $order);
|
$parts = explode(',', $order);
|
||||||
$query->orderBy($parts[0], $parts[1]);
|
$query->orderBy($parts[0], $parts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\Input::has('genres'))
|
if (Input::has('genres'))
|
||||||
$query->whereIn('genre_id', \Input::get('genres'));
|
$query->whereIn('genre_id', Input::get('genres'));
|
||||||
|
|
||||||
if (\Input::has('types'))
|
if (Input::has('types'))
|
||||||
$query->whereIn('track_type_id', \Input::get('types'));
|
$query->whereIn('track_type_id', Input::get('types'));
|
||||||
|
|
||||||
$dbTracks = $query->get();
|
$dbTracks = $query->get();
|
||||||
$tracks = [];
|
$tracks = [];
|
||||||
|
@ -57,7 +60,7 @@
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return \Response::json($tracks, 200);
|
return Response::json($tracks, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEdit($id) {
|
public function getEdit($id) {
|
||||||
|
@ -65,10 +68,10 @@
|
||||||
if (!$track)
|
if (!$track)
|
||||||
return $this->notFound('Track ' . $id . ' not found!');
|
return $this->notFound('Track ' . $id . ' not found!');
|
||||||
|
|
||||||
if ($track->user_id != \Auth::user()->id)
|
if ($track->user_id != Auth::user()->id)
|
||||||
return $this->notAuthorized();
|
return $this->notAuthorized();
|
||||||
|
|
||||||
return \Response::json([
|
return Response::json([
|
||||||
'id' => $track->id,
|
'id' => $track->id,
|
||||||
'title' => $track->title,
|
'title' => $track->title,
|
||||||
'user_id' => $track->user_id,
|
'user_id' => $track->user_id,
|
||||||
|
@ -94,6 +97,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putEdit($id) {
|
public function putEdit($id) {
|
||||||
return $this->execute(new EditTrackCommand($id, \Input::all()));
|
return $this->execute(new EditTrackCommand($id, Input::all()));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
angular.module('ponyfm').controller "account-settings", [
|
angular.module('ponyfm').controller "account-settings", [
|
||||||
'$scope', 'auth'
|
'$scope', 'auth'
|
||||||
($scope, auth) ->
|
($scope, auth) ->
|
||||||
|
|
||||||
]
|
]
|
Loading…
Reference in a new issue