mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 13:07:59 +01:00
Merge pull request #152 from Poniverse/shift-40784
This commit is contained in:
commit
4ff293dd39
115 changed files with 632 additions and 648 deletions
|
@ -22,9 +22,9 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class AddTrackToPlaylistCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace App\Commands;
|
|||
use App\Models\Album;
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Gate;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CreateAlbumCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Announcement;
|
||||
use Gate;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CreateAnnouncementCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@ use App\Models\Comment;
|
|||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Notification;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CreateCommentCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Genre;
|
||||
use Gate;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Validator;
|
||||
|
||||
class CreateGenreCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Playlist;
|
||||
use Auth;
|
||||
use Notification;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CreatePlaylistCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\ShowSong;
|
||||
use Gate;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Validator;
|
||||
|
||||
class CreateShowSongCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Gate;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class CreateUserCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Album;
|
||||
use Auth;
|
||||
use Gate;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class DeleteAlbumCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace App\Commands;
|
|||
|
||||
use App\Jobs\DeleteGenre;
|
||||
use App\Models\Genre;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class DeleteGenreCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Playlist;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DeletePlaylistCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace App\Commands;
|
|||
|
||||
use App\Jobs\DeleteShowSong;
|
||||
use App\Models\ShowSong;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class DeleteShowSongCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
namespace App\Commands;
|
||||
|
||||
use App\Models\Track;
|
||||
use Gate;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class DeleteTrackCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -23,10 +23,10 @@ namespace App\Commands;
|
|||
use App\Models\Album;
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Gate;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class EditAlbumCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\PinnedPlaylist;
|
||||
use App\Models\Playlist;
|
||||
use Auth;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class EditPlaylistCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -26,9 +26,9 @@ use App\Models\Playlist;
|
|||
use App\Models\Track;
|
||||
use App\Models\TrackType;
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Gate;
|
||||
use Notification;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
class EditTrackCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ use App\Models\Track;
|
|||
use App\Models\TrackFile;
|
||||
use AudioCache;
|
||||
use FFmpegMovie;
|
||||
use File;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use SplFileInfo;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ use App\Models\ResourceUser;
|
|||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MergeAccountsCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -28,9 +28,9 @@ use App\Models\TrackType;
|
|||
use App\Models\User;
|
||||
use AudioCache;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use File;
|
||||
use getID3;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RemoveTrackFromPlaylistCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace App\Commands;
|
|||
|
||||
use App\Jobs\UpdateTagsForRenamedGenre;
|
||||
use App\Models\Genre;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Validator;
|
||||
|
||||
class RenameGenreCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace App\Commands;
|
|||
|
||||
use App\Jobs\UpdateTagsForRenamedShowSong;
|
||||
use App\Models\ShowSong;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Validator;
|
||||
|
||||
class RenameShowSongCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Gate;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class SaveAccountSettingsCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -26,9 +26,9 @@ use App\Models\Favourite;
|
|||
use App\Models\Playlist;
|
||||
use App\Models\ResourceUser;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Notification;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
class ToggleFavouriteCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\Follower;
|
||||
use App\Models\ResourceUser;
|
||||
use Auth;
|
||||
use Notification;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
class ToggleFollowingCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -22,13 +22,13 @@ namespace App\Commands;
|
|||
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use Gate;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class UploadTrackCommand extends CommandBase
|
||||
{
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace App\Console\Commands;
|
|||
use App\Models\ShowSong;
|
||||
use App\Models\Track;
|
||||
use App\Models\TrackType;
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ClassifyMLPMA extends Command
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace App\Console\Commands;
|
|||
|
||||
use App\Models\TrackFile;
|
||||
use Carbon\Carbon;
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class ClearTrackCache extends Command
|
||||
{
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Image;
|
||||
use Config;
|
||||
use DB;
|
||||
use File;
|
||||
use getID3;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class FixMLPMAImages extends Command
|
||||
|
|
|
@ -8,13 +8,13 @@ use App\Models\Genre;
|
|||
use App\Models\Image;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use DB;
|
||||
use File;
|
||||
use getID3;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Input;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
|
|
@ -33,9 +33,9 @@ use App\Models\ResourceUser;
|
|||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MergeAccounts extends Command
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace App\Console\Commands;
|
|||
|
||||
use App\Models\Image;
|
||||
use App\Models\ResourceLogItem;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class MigrateOldData extends Command
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\TrackFile;
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class RebuildFilesizes extends Command
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ class RebuildTags extends Command
|
|||
$track = Track::findOrFail($this->argument('trackId'));
|
||||
$tracks = [$track];
|
||||
} else {
|
||||
$tracks = Track::whereNotNull('published_at')->withTrashed()->orderBy('id', 'asc')->get();
|
||||
$tracks = Track::whereNotNull('published_at')->withTrashed()->orderBy('id')->get();
|
||||
}
|
||||
|
||||
$numberOfTracks = count($tracks);
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace App\Console\Commands;
|
|||
use App\Jobs\EncodeTrackFile;
|
||||
use App\Models\Track;
|
||||
use App\Models\TrackFile;
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class RebuildTrackCache extends Command
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\ResourceLogItem;
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RefreshCache extends Command
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ class SyncPoniverseAccounts extends Command
|
|||
%current%/%max% [%bar%] %percent:3s%% %elapsed:6s%');
|
||||
|
||||
$usersToUpdate
|
||||
->orderBy('id', 'ASC')
|
||||
->orderBy('id')
|
||||
->chunk(100, function ($users) use ($progress) {
|
||||
/** @var User $user */
|
||||
foreach ($users as $user) {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\TrackFile;
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class VersionFiles extends Command
|
||||
{
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
use Redirect;
|
||||
use View;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AccountController extends Controller
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class AccountController extends Controller
|
|||
|
||||
public function getRegister()
|
||||
{
|
||||
return redirect(config('poniverse.urls')['register']);
|
||||
return redirect()->to(config('poniverse.urls')['register']);
|
||||
}
|
||||
|
||||
public function getNotifications()
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use View;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\AlbumDownloader;
|
||||
use App\Models\Album;
|
||||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use Redirect;
|
||||
use View;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AlbumsController extends Controller
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace App\Http\Controllers\Api\Mobile;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Track;
|
||||
use Response;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class TracksController extends Controller
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class TracksController extends Controller
|
|||
'tracks' => $tracks->toArray(),
|
||||
];
|
||||
|
||||
return Response::json($json, 200);
|
||||
return response()->json($json, 200);
|
||||
}
|
||||
|
||||
public function popular()
|
||||
|
@ -56,6 +56,6 @@ class TracksController extends Controller
|
|||
'tracks' => $tracks->toArray(),
|
||||
];
|
||||
|
||||
return Response::json($json, 200);
|
||||
return response()->json($json, 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use App\Commands\UploadTrackCommand;
|
|||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Image;
|
||||
use App\Models\Track;
|
||||
use Response;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class TracksController extends ApiControllerBase
|
||||
{
|
||||
|
@ -60,9 +60,9 @@ class TracksController extends ApiControllerBase
|
|||
$this->authorize('edit', $track);
|
||||
|
||||
if ($track->status === Track::STATUS_PROCESSING) {
|
||||
return Response::json(['message' => 'Processing...'], 202);
|
||||
return response()->json(['message' => 'Processing...'], 202);
|
||||
} elseif ($track->status === Track::STATUS_COMPLETE) {
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'message' => $track->published_at
|
||||
? 'Processing complete! The track is live at the track_url. The artist can edit the track by visiting its edit_url.'
|
||||
: 'Processing complete! The artist must publish the track by visiting its edit_url.',
|
||||
|
@ -71,7 +71,7 @@ class TracksController extends ApiControllerBase
|
|||
], 201);
|
||||
} else {
|
||||
// something went wrong
|
||||
return Response::json(['error' => 'Processing failed! Please contact logic@pony.fm to figure out what went wrong.'], 500);
|
||||
return response()->json(['error' => 'Processing failed! Please contact logic@pony.fm to figure out what went wrong.'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,10 @@ class TracksController extends ApiControllerBase
|
|||
->where('id', $id)->first();
|
||||
|
||||
if (! $track) {
|
||||
return Response::json(['message' => 'Track not found.'], 404);
|
||||
return response()->json(['message' => 'Track not found.'], 404);
|
||||
}
|
||||
|
||||
return Response::json(self::trackToJson($track, false, true), 200);
|
||||
return response()->json(self::trackToJson($track, false, true), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,10 +114,10 @@ class TracksController extends ApiControllerBase
|
|||
->where('hash', $hash)->first();
|
||||
|
||||
if (! $track) {
|
||||
return Response::json(['message' => 'Track not found.'], 403);
|
||||
return response()->json(['message' => 'Track not found.'], 403);
|
||||
}
|
||||
|
||||
return Response::json(self::trackToJson($track, true, false), 200);
|
||||
return response()->json(self::trackToJson($track, true, false), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,10 +24,10 @@ use App\Commands\SaveAccountSettingsCommand;
|
|||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Gate;
|
||||
use Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class AccountController extends ApiControllerBase
|
||||
{
|
||||
|
@ -35,23 +35,23 @@ class AccountController extends ApiControllerBase
|
|||
{
|
||||
$this->authorize('edit', $user);
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'user' => $user->toArray(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function getCurrentUser()
|
||||
public function getCurrentUser(Request $request)
|
||||
{
|
||||
$current_user = Auth::user();
|
||||
$current_user = $request->user();
|
||||
|
||||
if ($current_user != null) {
|
||||
$user = User::where('id', $current_user->id)->whereNull('disabled_at')->first();
|
||||
|
||||
if ($user == null) {
|
||||
return Response::json(['error' => 'You are not logged in'], 404);
|
||||
return response()->json(['error' => 'You are not logged in'], 404);
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'id' => $user->id,
|
||||
'name' => $user->display_name,
|
||||
'slug' => $user->slug,
|
||||
|
@ -64,14 +64,14 @@ class AccountController extends ApiControllerBase
|
|||
'created_at' => $user->created_at,
|
||||
], 200);
|
||||
} else {
|
||||
return Response::json(['error' => 'You are not logged in'], 404);
|
||||
return response()->json(['error' => 'You are not logged in'], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSettings($slug)
|
||||
public function getSettings(Request $request, $slug)
|
||||
{
|
||||
$user = null;
|
||||
$current_user = Auth::user();
|
||||
$current_user = $request->user();
|
||||
|
||||
if ($current_user != null) {
|
||||
if ($slug == $current_user->slug) {
|
||||
|
@ -81,15 +81,15 @@ class AccountController extends ApiControllerBase
|
|||
}
|
||||
|
||||
if ($user == null) {
|
||||
return Response::json(['error' => 'User does not exist'], 404);
|
||||
return response()->json(['error' => 'User does not exist'], 404);
|
||||
}
|
||||
|
||||
if (Gate::denies('edit', $user)) {
|
||||
return Response::json(['error' => 'You cannot do that. So stop trying!'], 403);
|
||||
return response()->json(['error' => 'You cannot do that. So stop trying!'], 403);
|
||||
}
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'id' => $user->id,
|
||||
'bio' => $user->bio,
|
||||
'can_see_explicit_content' => $user->can_see_explicit_content == 1,
|
||||
|
@ -104,8 +104,8 @@ class AccountController extends ApiControllerBase
|
|||
], 200);
|
||||
}
|
||||
|
||||
public function postSave(User $user)
|
||||
public function postSave(Request $request, User $user)
|
||||
{
|
||||
return $this->execute(new SaveAccountSettingsCommand(Request::all(), $user));
|
||||
return $this->execute(new SaveAccountSettingsCommand($request->all(), $user));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,22 +29,22 @@ use App\Models\Image;
|
|||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Gate;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class AlbumsController extends ApiControllerBase
|
||||
{
|
||||
public function postCreate()
|
||||
public function postCreate(Request $request)
|
||||
{
|
||||
return $this->execute(new CreateAlbumCommand(Request::all()));
|
||||
return $this->execute(new CreateAlbumCommand($request->all()));
|
||||
}
|
||||
|
||||
public function postEdit($id)
|
||||
public function postEdit(Request $request, $id)
|
||||
{
|
||||
return $this->execute(new EditAlbumCommand($id, Request::all()));
|
||||
return $this->execute(new EditAlbumCommand($id, $request->all()));
|
||||
}
|
||||
|
||||
public function postDelete($id)
|
||||
|
@ -52,7 +52,7 @@ class AlbumsController extends ApiControllerBase
|
|||
return $this->execute(new DeleteAlbumCommand($id));
|
||||
}
|
||||
|
||||
public function getShow($id)
|
||||
public function getShow(Request $request, $id)
|
||||
{
|
||||
$album = Album::with([
|
||||
'tracks' => function ($query) {
|
||||
|
@ -75,7 +75,7 @@ class AlbumsController extends ApiControllerBase
|
|||
abort(404);
|
||||
}
|
||||
|
||||
if (Request::get('log')) {
|
||||
if ($request->get('log')) {
|
||||
ResourceLogItem::logItem('album', $id, ResourceLogItem::VIEW);
|
||||
$album->view_count++;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class AlbumsController extends ApiControllerBase
|
|||
unset($returned_album['formats']);
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'album' => $returned_album,
|
||||
], 200);
|
||||
}
|
||||
|
@ -114,14 +114,14 @@ class AlbumsController extends ApiControllerBase
|
|||
$url = null;
|
||||
}
|
||||
|
||||
return Response::json(['url' => $url], 200);
|
||||
return response()->json(['url' => $url], 200);
|
||||
}
|
||||
|
||||
public function getIndex()
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
$page = 1;
|
||||
if (Request::has('page')) {
|
||||
$page = Request::get('page');
|
||||
if ($request->has('page')) {
|
||||
$page = $request->get('page');
|
||||
}
|
||||
|
||||
$query = Album::summary()
|
||||
|
@ -134,7 +134,7 @@ class AlbumsController extends ApiControllerBase
|
|||
$perPage = 40;
|
||||
|
||||
$query
|
||||
->orderBy('title', 'asc')
|
||||
->orderBy('title')
|
||||
->skip(($page - 1) * $perPage)
|
||||
->take($perPage);
|
||||
$albums = [];
|
||||
|
@ -143,7 +143,7 @@ class AlbumsController extends ApiControllerBase
|
|||
$albums[] = Album::mapPublicAlbumSummary($album);
|
||||
}
|
||||
|
||||
return Response::json(
|
||||
return response()->json(
|
||||
['albums' => $albums, 'current_page' => $page, 'total_pages' => ceil($count / $perPage)],
|
||||
200
|
||||
);
|
||||
|
@ -156,7 +156,7 @@ class AlbumsController extends ApiControllerBase
|
|||
$query = Album::summary()
|
||||
->with('cover', 'user.avatar')
|
||||
->where('user_id', $user->id)
|
||||
->orderBy('created_at', 'desc')->get();
|
||||
->orderByDesc('created_at')->get();
|
||||
$albums = [];
|
||||
|
||||
foreach ($query as $album) {
|
||||
|
@ -172,17 +172,17 @@ class AlbumsController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
return Response::json($albums, 200);
|
||||
return response()->json($albums, 200);
|
||||
}
|
||||
|
||||
public function getEdit($id)
|
||||
public function getEdit(Request $request, $id)
|
||||
{
|
||||
$album = Album::with('tracks')->find($id);
|
||||
if (! $album) {
|
||||
return $this->notFound('Album '.$id.' not found!');
|
||||
}
|
||||
|
||||
if (Gate::denies('edit', Auth::user())) {
|
||||
if (Gate::denies('edit', $request->user())) {
|
||||
return $this->notAuthorized();
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ class AlbumsController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'id' => $album->id,
|
||||
'title' => $album->title,
|
||||
'user_id' => $album->user_id,
|
||||
|
|
|
@ -24,8 +24,8 @@ use App\Commands\CreateAnnouncementCommand;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Announcement;
|
||||
use Carbon\Carbon;
|
||||
use Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class AnnouncementsController extends Controller
|
||||
{
|
||||
|
@ -37,11 +37,11 @@ class AnnouncementsController extends Controller
|
|||
->whereNotNull('end_time')
|
||||
->where('start_time', '<', $currentDate)
|
||||
->where('end_time', '>', $currentDate)
|
||||
->orderBy('start_time', 'desc');
|
||||
->orderByDesc('start_time');
|
||||
|
||||
$announcement = $query->first();
|
||||
|
||||
return Response::json(
|
||||
return response()->json(
|
||||
['announcement' => $announcement],
|
||||
200
|
||||
);
|
||||
|
@ -51,10 +51,10 @@ class AnnouncementsController extends Controller
|
|||
{
|
||||
$this->authorize('access-admin-area');
|
||||
|
||||
$announcements = Announcement::orderBy('start_time', 'desc')
|
||||
$announcements = Announcement::orderByDesc('start_time')
|
||||
->get();
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'announcements' => $announcements->toArray(),
|
||||
], 200);
|
||||
}
|
||||
|
@ -64,19 +64,19 @@ class AnnouncementsController extends Controller
|
|||
$this->authorize('access-admin-area');
|
||||
|
||||
$query = Announcement::where('id', '=', $genreId)
|
||||
->orderBy('start_time', 'desc');
|
||||
->orderByDesc('start_time');
|
||||
|
||||
$announcement = $query->first();
|
||||
|
||||
return Response::json(
|
||||
return response()->json(
|
||||
['announcement' => $announcement],
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
public function postCreate()
|
||||
public function postCreate(Request $request)
|
||||
{
|
||||
$command = new CreateAnnouncementCommand(Request::get('name'));
|
||||
$command = new CreateAnnouncementCommand($request->get('name'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
namespace App\Http\Controllers\Api\Web;
|
||||
|
||||
use App;
|
||||
use App\Commands\CreateUserCommand;
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Album;
|
||||
|
@ -31,10 +30,11 @@ use App\Models\Image;
|
|||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use ColorThief\ColorThief;
|
||||
use Gate;
|
||||
use Helpers;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class ArtistsController extends ApiControllerBase
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ class ArtistsController extends ApiControllerBase
|
|||
}
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'tracks' => $tracks,
|
||||
'albums' => $albums,
|
||||
], 200);
|
||||
|
@ -112,7 +112,7 @@ class ArtistsController extends ApiControllerBase
|
|||
|
||||
$query = Album::summary()
|
||||
->with('user')
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderByDesc('created_at')
|
||||
->where('track_count', '>', 0)
|
||||
->whereUserId($user->id);
|
||||
|
||||
|
@ -122,7 +122,7 @@ class ArtistsController extends ApiControllerBase
|
|||
$albums[] = Album::mapPublicAlbumSummary($album);
|
||||
}
|
||||
|
||||
return Response::json(['singles' => $singles, 'albumTracks' => $tracks, 'albums' => $albums], 200);
|
||||
return response()->json(['singles' => $singles, 'albumTracks' => $tracks, 'albums' => $albums], 200);
|
||||
}
|
||||
|
||||
public function getShow($slug)
|
||||
|
@ -148,7 +148,7 @@ class ArtistsController extends ApiControllerBase
|
|||
->userDetails()
|
||||
->whereUserId($user->id)
|
||||
->whereNotNull('published_at')
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderByDesc('created_at')
|
||||
->take(20);
|
||||
|
||||
$latestTracks = [];
|
||||
|
@ -178,7 +178,7 @@ class ArtistsController extends ApiControllerBase
|
|||
$followers = Follower::where('artist_id', $user->id)
|
||||
->count();
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'artist' => [
|
||||
'id' => $user->id,
|
||||
'name' => $user->display_name,
|
||||
|
@ -206,11 +206,11 @@ class ArtistsController extends ApiControllerBase
|
|||
], 200);
|
||||
}
|
||||
|
||||
public function getIndex()
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
$page = 1;
|
||||
if (Request::has('page')) {
|
||||
$page = Request::get('page');
|
||||
if ($request->has('page')) {
|
||||
$page = $request->get('page');
|
||||
}
|
||||
|
||||
$query = User::where('track_count', '>', 0);
|
||||
|
@ -218,7 +218,7 @@ class ArtistsController extends ApiControllerBase
|
|||
|
||||
// The query results are ordered after they're counted
|
||||
// due to Postgres's behaviour when combining those two operations.
|
||||
$query->orderBy('display_name', 'asc');
|
||||
$query->orderBy('display_name');
|
||||
$perPage = 40;
|
||||
$query->skip(($page - 1) * $perPage)->take($perPage);
|
||||
$users = [];
|
||||
|
@ -227,15 +227,15 @@ class ArtistsController extends ApiControllerBase
|
|||
$users[] = User::mapPublicUserSummary($user);
|
||||
}
|
||||
|
||||
return Response::json(
|
||||
return response()->json(
|
||||
['artists' => $users, 'current_page' => $page, 'total_pages' => ceil($count / $perPage)],
|
||||
200
|
||||
);
|
||||
}
|
||||
|
||||
public function postIndex()
|
||||
public function postIndex(Request $request)
|
||||
{
|
||||
$name = Request::json('username');
|
||||
$name = $request->json('username');
|
||||
|
||||
return $this->execute(new CreateUserCommand($name, $name, null, true));
|
||||
}
|
||||
|
|
|
@ -20,18 +20,18 @@
|
|||
|
||||
namespace App\Http\Controllers\Api\Web;
|
||||
|
||||
use App;
|
||||
use App\Commands\CreateCommentCommand;
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class CommentsController extends ApiControllerBase
|
||||
{
|
||||
public function postCreate($type, $id)
|
||||
public function postCreate(Request $request, $type, $id)
|
||||
{
|
||||
return $this->execute(new CreateCommentCommand($type, $id, Request::all()));
|
||||
return $this->execute(new CreateCommentCommand($type, $id, $request->all()));
|
||||
}
|
||||
|
||||
public function getIndex($type, $id)
|
||||
|
@ -56,13 +56,13 @@ class CommentsController extends ApiControllerBase
|
|||
}
|
||||
}
|
||||
|
||||
$query = Comment::where($column, '=', $id)->orderBy('created_at', 'desc')->with('user');
|
||||
$query = Comment::where($column, '=', $id)->orderByDesc('created_at')->with('user');
|
||||
$comments = [];
|
||||
|
||||
foreach ($query->get() as $comment) {
|
||||
$comments[] = Comment::mapPublic($comment);
|
||||
}
|
||||
|
||||
return Response::json(['list' => $comments, 'count' => count($comments)]);
|
||||
return response()->json(['list' => $comments, 'count' => count($comments)]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,13 @@ namespace App\Http\Controllers\Api\Web;
|
|||
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class DashboardController extends ApiControllerBase
|
||||
{
|
||||
public function getIndex()
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
$recentQuery = Track::summary()
|
||||
->with(['genre', 'user', 'cover', 'user.avatar'])
|
||||
|
@ -36,7 +37,7 @@ class DashboardController extends ApiControllerBase
|
|||
->userDetails()
|
||||
->explicitFilter()
|
||||
->published()
|
||||
->orderBy('published_at', 'desc')
|
||||
->orderByDesc('published_at')
|
||||
->take(30);
|
||||
|
||||
$recentQuery->whereHas('user', function ($q) {
|
||||
|
@ -49,9 +50,9 @@ class DashboardController extends ApiControllerBase
|
|||
$recentTracks[] = Track::mapPublicTrackSummary($track);
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'recent_tracks' => $recentTracks,
|
||||
'popular_tracks' => Track::popular(30, Auth::check() && Auth::user()->can_see_explicit_content),
|
||||
'popular_tracks' => Track::popular(30, $request->user() && $request->user()->can_see_explicit_content),
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,21 +26,21 @@ use App\Models\Album;
|
|||
use App\Models\Favourite;
|
||||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class FavouritesController extends ApiControllerBase
|
||||
{
|
||||
public function postToggle()
|
||||
public function postToggle(Request $request)
|
||||
{
|
||||
return $this->execute(new ToggleFavouriteCommand(Request::get('type'), Request::get('id')));
|
||||
return $this->execute(new ToggleFavouriteCommand($request->get('type'), $request->get('id')));
|
||||
}
|
||||
|
||||
public function getTracks()
|
||||
public function getTracks(Request $request)
|
||||
{
|
||||
$query = Favourite
|
||||
::whereUserId(Auth::user()->id)
|
||||
::whereUserId($request->user()->id)
|
||||
->whereNotNull('track_id')
|
||||
->with([
|
||||
'track' => function ($query) {
|
||||
|
@ -65,13 +65,13 @@ class FavouritesController extends ApiControllerBase
|
|||
$tracks[] = Track::mapPublicTrackSummary($fav->track);
|
||||
}
|
||||
|
||||
return Response::json(['tracks' => $tracks], 200);
|
||||
return response()->json(['tracks' => $tracks], 200);
|
||||
}
|
||||
|
||||
public function getAlbums()
|
||||
public function getAlbums(Request $request)
|
||||
{
|
||||
$query = Favourite
|
||||
::whereUserId(Auth::user()->id)
|
||||
::whereUserId($request->user()->id)
|
||||
->whereNotNull('album_id')
|
||||
->with([
|
||||
'album' => function ($query) {
|
||||
|
@ -92,13 +92,13 @@ class FavouritesController extends ApiControllerBase
|
|||
$albums[] = Album::mapPublicAlbumSummary($fav->album);
|
||||
}
|
||||
|
||||
return Response::json(['albums' => $albums], 200);
|
||||
return response()->json(['albums' => $albums], 200);
|
||||
}
|
||||
|
||||
public function getPlaylist()
|
||||
public function getPlaylist(Request $request)
|
||||
{
|
||||
$query = Favourite
|
||||
::whereUserId(Auth::user()->id)
|
||||
::whereUserId($request->user()->id)
|
||||
->whereNotNull('playlist_id')
|
||||
->with([
|
||||
'playlist' => function ($query) {
|
||||
|
@ -120,6 +120,6 @@ class FavouritesController extends ApiControllerBase
|
|||
$playlists[] = Playlist::mapPublicPlaylistSummary($fav->playlist);
|
||||
}
|
||||
|
||||
return Response::json(['playlists' => $playlists], 200);
|
||||
return response()->json(['playlists' => $playlists], 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@ namespace App\Http\Controllers\Api\Web;
|
|||
|
||||
use App\Commands\ToggleFollowingCommand;
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FollowController extends ApiControllerBase
|
||||
{
|
||||
public function postToggle()
|
||||
public function postToggle(Request $request)
|
||||
{
|
||||
return $this->execute(new ToggleFollowingCommand(Request::get('type'), Request::get('id')));
|
||||
return $this->execute(new ToggleFollowingCommand($request->get('type'), $request->get('id')));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ use App\Commands\DeleteGenreCommand;
|
|||
use App\Commands\RenameGenreCommand;
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Genre;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class GenresController extends ApiControllerBase
|
||||
{
|
||||
|
@ -37,31 +37,31 @@ class GenresController extends ApiControllerBase
|
|||
$genres = Genre::with(['trackCountRelation' => function ($query) {
|
||||
$query->withTrashed();
|
||||
}])
|
||||
->orderBy('name', 'asc')
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'genres' => $genres->toArray(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function postCreate()
|
||||
public function postCreate(Request $request)
|
||||
{
|
||||
$command = new CreateGenreCommand(Request::get('name'));
|
||||
$command = new CreateGenreCommand($request->get('name'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
||||
public function putRename($genreId)
|
||||
public function putRename(Request $request, $genreId)
|
||||
{
|
||||
$command = new RenameGenreCommand($genreId, Request::get('name'));
|
||||
$command = new RenameGenreCommand($genreId, $request->get('name'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
||||
public function deleteGenre($genreId)
|
||||
public function deleteGenre(Request $request, $genreId)
|
||||
{
|
||||
$command = new DeleteGenreCommand($genreId, Request::get('destination_genre_id'));
|
||||
$command = new DeleteGenreCommand($genreId, $request->get('destination_genre_id'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace App\Http\Controllers\Api\Web;
|
|||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\Image;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class ImagesController extends ApiControllerBase
|
||||
{
|
||||
|
@ -48,6 +48,6 @@ class ImagesController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
return Response::json($images, 200);
|
||||
return response()->json($images, 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ use App\Models\Notification;
|
|||
use App\Models\Subscription;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Minishlink\WebPush\WebPush;
|
||||
|
||||
class NotificationsController extends ApiControllerBase
|
||||
|
@ -36,9 +36,9 @@ class NotificationsController extends ApiControllerBase
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getNotifications()
|
||||
public function getNotifications(Request $request)
|
||||
{
|
||||
$notifications = Notification::forUser(Auth::user())
|
||||
$notifications = Notification::forUser($request->user())
|
||||
->take(20)
|
||||
->get();
|
||||
|
||||
|
@ -54,10 +54,10 @@ class NotificationsController extends ApiControllerBase
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public function putMarkAsRead()
|
||||
public function putMarkAsRead(Request $request)
|
||||
{
|
||||
$notificationIds = Request::json('notification_ids');
|
||||
$numberOfUpdatedRows = Auth::user()
|
||||
$notificationIds = $request->json('notification_ids');
|
||||
$numberOfUpdatedRows = $request->user()
|
||||
->notifications()
|
||||
->whereIn('id', $notificationIds)
|
||||
->update(['is_read' => true]);
|
||||
|
@ -72,17 +72,17 @@ class NotificationsController extends ApiControllerBase
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function postSubscribe()
|
||||
public function postSubscribe(Request $request)
|
||||
{
|
||||
$input = json_decode(Request::json('subscription'));
|
||||
$input = json_decode($request->json('subscription'));
|
||||
if ($input != 'null') {
|
||||
$existing = Subscription::where('endpoint', '=', $input->endpoint)
|
||||
->where('user_id', '=', Auth::user()->id)
|
||||
->where('user_id', '=', $request->user()->id)
|
||||
->first();
|
||||
|
||||
if ($existing === null) {
|
||||
$subscription = Subscription::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'user_id' => $request->user()->id,
|
||||
'endpoint' => $input->endpoint,
|
||||
'p256dh' => $input->keys->p256dh,
|
||||
'auth' => $input->keys->auth,
|
||||
|
@ -102,12 +102,12 @@ class NotificationsController extends ApiControllerBase
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function postUnsubscribe()
|
||||
public function postUnsubscribe(Request $request)
|
||||
{
|
||||
$input = json_decode(Request::json('subscription'));
|
||||
$input = json_decode($request->json('subscription'));
|
||||
|
||||
$existing = Subscription::where('endpoint', '=', $input->endpoint)
|
||||
->where('user_id', '=', Auth::user()->id)
|
||||
->where('user_id', '=', $request->user()->id)
|
||||
->delete();
|
||||
|
||||
return ['result' => 'success'];
|
||||
|
|
|
@ -31,21 +31,21 @@ use App\Models\Playlist;
|
|||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class PlaylistsController extends ApiControllerBase
|
||||
{
|
||||
public function postCreate()
|
||||
public function postCreate(Request $request)
|
||||
{
|
||||
return $this->execute(new CreatePlaylistCommand(Request::all()));
|
||||
return $this->execute(new CreatePlaylistCommand($request->all()));
|
||||
}
|
||||
|
||||
public function postEdit($id)
|
||||
public function postEdit(Request $request, $id)
|
||||
{
|
||||
return $this->execute(new EditPlaylistCommand($id, Request::all()));
|
||||
return $this->execute(new EditPlaylistCommand($id, $request->all()));
|
||||
}
|
||||
|
||||
public function postDelete($id)
|
||||
|
@ -53,19 +53,19 @@ class PlaylistsController extends ApiControllerBase
|
|||
return $this->execute(new DeletePlaylistCommand($id));
|
||||
}
|
||||
|
||||
public function postAddTrack($id)
|
||||
public function postAddTrack(Request $request, $id)
|
||||
{
|
||||
return $this->execute(new AddTrackToPlaylistCommand($id, Request::get('track_id')));
|
||||
return $this->execute(new AddTrackToPlaylistCommand($id, $request->get('track_id')));
|
||||
}
|
||||
|
||||
public function postRemoveTrack($id)
|
||||
public function postRemoveTrack(Request $request, $id)
|
||||
{
|
||||
return $this->execute(new RemoveTrackFromPlaylistCommand($id, Request::get('track_id')));
|
||||
return $this->execute(new RemoveTrackFromPlaylistCommand($id, $request->get('track_id')));
|
||||
}
|
||||
|
||||
public function getIndex()
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
$page = Request::has('page') ? Request::get('page') : 1;
|
||||
$page = $request->has('page') ? $request->get('page') : 1;
|
||||
|
||||
$query = Playlist::summary()
|
||||
->with(
|
||||
|
@ -94,14 +94,14 @@ class PlaylistsController extends ApiControllerBase
|
|||
$playlists[] = Playlist::mapPublicPlaylistSummary($playlist);
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'playlists' => $playlists,
|
||||
'current_page' => $page,
|
||||
'total_pages' => ceil($count / $perPage),
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function getShow($id)
|
||||
public function getShow(Request $request, $id)
|
||||
{
|
||||
$playlist = Playlist::with([
|
||||
'tracks.user',
|
||||
|
@ -115,19 +115,19 @@ class PlaylistsController extends ApiControllerBase
|
|||
'comments',
|
||||
'comments.user',
|
||||
])->userDetails()->find($id);
|
||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||
if (! $playlist || ! $playlist->canView($request->user())) {
|
||||
abort('404');
|
||||
}
|
||||
|
||||
if (Request::get('log')) {
|
||||
if ($request->get('log')) {
|
||||
ResourceLogItem::logItem('playlist', $id, ResourceLogItem::VIEW);
|
||||
$playlist->view_count++;
|
||||
}
|
||||
|
||||
return Response::json(Playlist::mapPublicPlaylistShow($playlist), 200);
|
||||
return response()->json(Playlist::mapPublicPlaylistShow($playlist), 200);
|
||||
}
|
||||
|
||||
public function getCachedPlaylist($id, $format)
|
||||
public function getCachedPlaylist(Request $request, $id, $format)
|
||||
{
|
||||
// Validation
|
||||
try {
|
||||
|
@ -137,7 +137,7 @@ class PlaylistsController extends ApiControllerBase
|
|||
return $this->notFound('Playlist not found!');
|
||||
}
|
||||
|
||||
if ((! $playlist->is_public && ! Auth::check()) || (! $playlist->is_public && ($playlist->user_id !== Auth::user()->id))) {
|
||||
if ((! $playlist->is_public && ! $request->user()) || (! $playlist->is_public && ($playlist->user_id !== $request->user()->id))) {
|
||||
return $this->notFound('Playlist not found!');
|
||||
}
|
||||
|
||||
|
@ -155,10 +155,10 @@ class PlaylistsController extends ApiControllerBase
|
|||
$url = null;
|
||||
}
|
||||
|
||||
return Response::json(['url' => $url], 200);
|
||||
return response()->json(['url' => $url], 200);
|
||||
}
|
||||
|
||||
public function getPinned()
|
||||
public function getPinned(Request $request)
|
||||
{
|
||||
$query = Playlist
|
||||
::userDetails()
|
||||
|
@ -166,8 +166,8 @@ class PlaylistsController extends ApiControllerBase
|
|||
->join('pinned_playlists', function ($join) {
|
||||
$join->on('playlist_id', '=', 'playlists.id');
|
||||
})
|
||||
->where('pinned_playlists.user_id', '=', Auth::user()->id)
|
||||
->orderBy('title', 'asc')
|
||||
->where('pinned_playlists.user_id', '=', $request->user()->id)
|
||||
->orderBy('title')
|
||||
->select('playlists.*')
|
||||
->get();
|
||||
|
||||
|
@ -179,15 +179,15 @@ class PlaylistsController extends ApiControllerBase
|
|||
$playlists[] = $mapped;
|
||||
}
|
||||
|
||||
return Response::json($playlists, 200);
|
||||
return response()->json($playlists, 200);
|
||||
}
|
||||
|
||||
public function getOwned(User $user)
|
||||
public function getOwned(Request $request, User $user)
|
||||
{
|
||||
$query = Playlist::summary()
|
||||
->with('pins', 'tracks', 'tracks.cover')
|
||||
->where('user_id', $user->id)
|
||||
->orderBy('title', 'asc')
|
||||
->orderBy('title')
|
||||
->get();
|
||||
|
||||
$playlists = [];
|
||||
|
@ -203,13 +203,13 @@ class PlaylistsController extends ApiControllerBase
|
|||
'small' => $playlist->getCoverUrl(Image::SMALL),
|
||||
'normal' => $playlist->getCoverUrl(Image::NORMAL),
|
||||
],
|
||||
'is_pinned' => $playlist->hasPinFor(Auth::user()->id),
|
||||
'is_pinned' => $playlist->hasPinFor($request->user()->id),
|
||||
'is_public' => $playlist->is_public == 1,
|
||||
'track_ids' => $playlist->tracks->pluck('id'),
|
||||
];
|
||||
}
|
||||
|
||||
return Response::json($playlists, 200);
|
||||
return response()->json($playlists, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,16 +23,16 @@ namespace App\Http\Controllers\Api\Web;
|
|||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Library\Search;
|
||||
use Elasticsearch;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class SearchController extends ApiControllerBase
|
||||
{
|
||||
public function getSearch(Search $search)
|
||||
public function getSearch(Request $request, Search $search)
|
||||
{
|
||||
$results = $search->searchAllContent(Request::query('query'));
|
||||
$results = $search->searchAllContent($request->query('query'));
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'results' => $results,
|
||||
], 200);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ use App\Commands\DeleteShowSongCommand;
|
|||
use App\Commands\RenameShowSongCommand;
|
||||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\ShowSong;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class ShowSongsController extends ApiControllerBase
|
||||
{
|
||||
|
@ -37,32 +37,32 @@ class ShowSongsController extends ApiControllerBase
|
|||
$songs = ShowSong::with(['trackCountRelation' => function ($query) {
|
||||
$query->withTrashed();
|
||||
}])
|
||||
->orderBy('title', 'asc')
|
||||
->orderBy('title')
|
||||
->select('id', 'title', 'slug')
|
||||
->get();
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'showsongs' => $songs->toArray(),
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function postCreate()
|
||||
public function postCreate(Request $request)
|
||||
{
|
||||
$command = new CreateShowSongCommand(Request::get('title'));
|
||||
$command = new CreateShowSongCommand($request->get('title'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
||||
public function putRename($songId)
|
||||
public function putRename(Request $request, $songId)
|
||||
{
|
||||
$command = new RenameShowSongCommand($songId, Request::get('title'));
|
||||
$command = new RenameShowSongCommand($songId, $request->get('title'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
||||
public function deleteSong($songId)
|
||||
public function deleteSong(Request $request, $songId)
|
||||
{
|
||||
$command = new DeleteShowSongCommand($songId, Request::get('destination_song_id'));
|
||||
$command = new DeleteShowSongCommand($songId, $request->get('destination_song_id'));
|
||||
|
||||
return $this->execute($command);
|
||||
}
|
||||
|
|
|
@ -23,13 +23,14 @@ namespace App\Http\Controllers\Api\Web;
|
|||
use App\Http\Controllers\ApiControllerBase;
|
||||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Str;
|
||||
use Response;
|
||||
|
||||
class StatsController extends ApiControllerBase
|
||||
{
|
||||
|
@ -101,13 +102,13 @@ class StatsController extends ApiControllerBase
|
|||
}
|
||||
|
||||
if ($hourly) {
|
||||
return Response::json(['playStats' => $output, 'type' => 'Hourly'], 200);
|
||||
return response()->json(['playStats' => $output, 'type' => 'Hourly'], 200);
|
||||
} else {
|
||||
return Response::json(['playStats' => $output, 'type' => 'Daily'], 200);
|
||||
return response()->json(['playStats' => $output, 'type' => 'Daily'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTrackStats($id)
|
||||
public function getTrackStats(Request $request, $id)
|
||||
{
|
||||
$cachedOutput = Cache::remember('track_stats'.$id, 300, function () use ($id) {
|
||||
try {
|
||||
|
@ -117,7 +118,7 @@ class StatsController extends ApiControllerBase
|
|||
}
|
||||
|
||||
// Do we have permission to view this track?
|
||||
if (! $track->canView(Auth::user())) {
|
||||
if (! $track->canView($request->user())) {
|
||||
return $this->notFound('Track not found!');
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ use App\Models\Genre;
|
|||
use App\Models\License;
|
||||
use App\Models\ShowSong;
|
||||
use App\Models\TrackType;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TaxonomiesController extends ApiControllerBase
|
||||
{
|
||||
public function getAll()
|
||||
{
|
||||
return \Response::json([
|
||||
return response()->json([
|
||||
'licenses' => License::all()->toArray(),
|
||||
'genres' => Genre::with('trackCountRelation')
|
||||
->orderBy('name')
|
||||
|
|
|
@ -32,11 +32,11 @@ use App\Models\Track;
|
|||
use App\Models\TrackFile;
|
||||
use App\Models\TrackType;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use File;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class TracksController extends ApiControllerBase
|
||||
|
@ -54,12 +54,12 @@ class TracksController extends ApiControllerBase
|
|||
$this->authorize('edit', $track);
|
||||
|
||||
if ($track->status === Track::STATUS_PROCESSING) {
|
||||
return Response::json(['message' => 'Processing...'], 202);
|
||||
return response()->json(['message' => 'Processing...'], 202);
|
||||
} elseif ($track->status === Track::STATUS_COMPLETE) {
|
||||
return Response::json(['message' => 'Processing complete!'], 201);
|
||||
return response()->json(['message' => 'Processing complete!'], 201);
|
||||
} else {
|
||||
// something went wrong
|
||||
return Response::json(['error' => 'Processing failed!'], 500);
|
||||
return response()->json(['error' => 'Processing failed!'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,9 +68,9 @@ class TracksController extends ApiControllerBase
|
|||
return $this->execute(new DeleteTrackCommand($id));
|
||||
}
|
||||
|
||||
public function postEdit($id)
|
||||
public function postEdit(Request $request, $id)
|
||||
{
|
||||
return $this->execute(new EditTrackCommand($id, Request::all()));
|
||||
return $this->execute(new EditTrackCommand($id, $request->all()));
|
||||
}
|
||||
|
||||
public function postUploadNewVersion($trackId)
|
||||
|
@ -95,12 +95,12 @@ class TracksController extends ApiControllerBase
|
|||
$this->authorize('edit', $track);
|
||||
|
||||
if ($track->version_upload_status === Track::STATUS_PROCESSING) {
|
||||
return Response::json(['message' => 'Processing...'], 202);
|
||||
return response()->json(['message' => 'Processing...'], 202);
|
||||
} elseif ($track->version_upload_status === Track::STATUS_COMPLETE) {
|
||||
return Response::json(['message' => 'Processing complete!'], 201);
|
||||
return response()->json(['message' => 'Processing complete!'], 201);
|
||||
} else {
|
||||
// something went wrong
|
||||
return Response::json(['error' => 'Processing failed!'], 500);
|
||||
return response()->json(['error' => 'Processing failed!'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class TracksController extends ApiControllerBase
|
|||
];
|
||||
}
|
||||
|
||||
return Response::json(['current_version' => $track->current_version, 'versions' => $versions], 200);
|
||||
return response()->json(['current_version' => $track->current_version, 'versions' => $versions], 200);
|
||||
}
|
||||
|
||||
public function getChangeVersion($trackId, $newVersion)
|
||||
|
@ -142,14 +142,14 @@ class TracksController extends ApiControllerBase
|
|||
return $this->execute(new GenerateTrackFilesCommand($track, $sourceFile, false, false, true, $newVersion));
|
||||
}
|
||||
|
||||
public function getShow($id)
|
||||
public function getShow(Request $request, $id)
|
||||
{
|
||||
$track = Track::userDetails()->withComments()->find($id);
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
return $this->notFound('Track not found!');
|
||||
}
|
||||
|
||||
if (Request::get('log')) {
|
||||
if ($request->get('log')) {
|
||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::VIEW);
|
||||
$track->view_count++;
|
||||
}
|
||||
|
@ -159,10 +159,10 @@ class TracksController extends ApiControllerBase
|
|||
unset($returned_track['formats']);
|
||||
}
|
||||
|
||||
return Response::json(['track' => $returned_track], 200);
|
||||
return response()->json(['track' => $returned_track], 200);
|
||||
}
|
||||
|
||||
public function getCachedTrack($id, $format)
|
||||
public function getCachedTrack(Request $request, $id, $format)
|
||||
{
|
||||
// Validation
|
||||
try {
|
||||
|
@ -171,7 +171,7 @@ class TracksController extends ApiControllerBase
|
|||
return $this->notFound('Track not found!');
|
||||
}
|
||||
|
||||
if (! $track->canView(Auth::user())) {
|
||||
if (! $track->canView($request->user())) {
|
||||
return $this->notFound('Track not found!');
|
||||
}
|
||||
|
||||
|
@ -199,16 +199,16 @@ class TracksController extends ApiControllerBase
|
|||
$url = null;
|
||||
}
|
||||
|
||||
return Response::json(['url' => $url], 200);
|
||||
return response()->json(['url' => $url], 200);
|
||||
}
|
||||
|
||||
public function getIndex($all = false, $unknown = false)
|
||||
public function getIndex(Request $request, $all = false, $unknown = false)
|
||||
{
|
||||
$page = 1;
|
||||
$perPage = 45;
|
||||
|
||||
if (Request::has('page')) {
|
||||
$page = Request::get('page');
|
||||
if ($request->has('page')) {
|
||||
$page = $request->get('page');
|
||||
}
|
||||
|
||||
if ($all) {
|
||||
|
@ -240,7 +240,7 @@ class TracksController extends ApiControllerBase
|
|||
$ids[] = $track->id;
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'tracks' => $tracks,
|
||||
'current_page' => $page,
|
||||
'total_pages' => ceil($totalCount / $perPage),
|
||||
|
@ -263,14 +263,14 @@ class TracksController extends ApiControllerBase
|
|||
|
||||
public function getOwned(User $user)
|
||||
{
|
||||
$query = Track::summary()->where('user_id', $user->id)->orderBy('created_at', 'desc');
|
||||
$query = Track::summary()->where('user_id', $user->id)->orderByDesc('created_at');
|
||||
|
||||
$tracks = [];
|
||||
foreach ($query->get() as $track) {
|
||||
$tracks[] = Track::mapPrivateTrackSummary($track);
|
||||
}
|
||||
|
||||
return Response::json($tracks, 200);
|
||||
return response()->json($tracks, 200);
|
||||
}
|
||||
|
||||
public function getEdit($id)
|
||||
|
@ -282,7 +282,7 @@ class TracksController extends ApiControllerBase
|
|||
|
||||
$this->authorize('edit', $track);
|
||||
|
||||
return Response::json(Track::mapPrivateTrackShow($track), 200);
|
||||
return response()->json(Track::mapPrivateTrackShow($track), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Commands\CommandBase;
|
||||
use Response;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
abstract class ApiControllerBase extends Controller
|
||||
{
|
||||
|
@ -40,22 +40,22 @@ abstract class ApiControllerBase extends Controller
|
|||
|
||||
$result = $command->execute();
|
||||
if ($result->didFail()) {
|
||||
return Response::json([
|
||||
return response()->json([
|
||||
'message' => 'Validation failed',
|
||||
'errors' => $result->getMessages(),
|
||||
], $result->getStatusCode());
|
||||
}
|
||||
|
||||
return Response::json($result->getResponse(), $result->getStatusCode());
|
||||
return response()->json($result->getResponse(), $result->getStatusCode());
|
||||
}
|
||||
|
||||
public function notAuthorized()
|
||||
{
|
||||
return Response::json(['message' => 'You may not do this!'], 403);
|
||||
return response()->json(['message' => 'You may not do this!'], 403);
|
||||
}
|
||||
|
||||
public function notFound($message)
|
||||
{
|
||||
return Response::json(['message' => $message], 403);
|
||||
return response()->json(['message' => $message], 403);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Models\User;
|
||||
use Redirect;
|
||||
use View;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class ArtistsController extends Controller
|
||||
{
|
||||
|
|
|
@ -22,15 +22,15 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Models\Activity;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||
use League\OAuth2\Client\Token\AccessToken;
|
||||
use Log;
|
||||
use Poniverse\Lib\Client;
|
||||
use Redirect;
|
||||
use Request;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
@ -50,23 +50,23 @@ class AuthController extends Controller
|
|||
->getAuthorizationUrl());
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
return redirect()->to('/');
|
||||
}
|
||||
|
||||
public function postLogout()
|
||||
{
|
||||
Auth::logout();
|
||||
|
||||
return redirect('/');
|
||||
return redirect()->to('/');
|
||||
}
|
||||
|
||||
public function getOAuth()
|
||||
public function getOAuth(Request $request)
|
||||
{
|
||||
$oauthProvider = $this->poniverse->getOAuthProvider();
|
||||
|
||||
try {
|
||||
$accessToken = $oauthProvider->getAccessToken('authorization_code', [
|
||||
'code' => Request::query('code'),
|
||||
'code' => $request->query('code'),
|
||||
'redirect_uri' => action('AuthController@getOAuth'),
|
||||
]);
|
||||
$this->poniverse->setAccessToken($accessToken);
|
||||
|
@ -74,7 +74,7 @@ class AuthController extends Controller
|
|||
} catch (IdentityProviderException $e) {
|
||||
Log::error($e);
|
||||
|
||||
return redirect('/')->with(
|
||||
return redirect()->to('/')->with(
|
||||
'message',
|
||||
'Unfortunately we are having problems attempting to log you in at the moment. Please try again at a later time.'
|
||||
);
|
||||
|
@ -129,14 +129,14 @@ class AuthController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postPoniverseAccountSync()
|
||||
public function postPoniverseAccountSync(Request $request)
|
||||
{
|
||||
$poniverseId = Request::get('id');
|
||||
$updatedAttribute = Request::get('attribute');
|
||||
$poniverseId = $request->get('id');
|
||||
$updatedAttribute = $request->get('attribute');
|
||||
|
||||
// Only email address updates are supported at this time.
|
||||
if ('email' !== $updatedAttribute) {
|
||||
return \Response::json(['message' => 'Unsupported Poniverse account attribute.'], 400);
|
||||
return response()->json(['message' => 'Unsupported Poniverse account attribute.'], 400);
|
||||
}
|
||||
|
||||
$user = User::wherePoniverseId($poniverseId)->first();
|
||||
|
@ -154,13 +154,13 @@ class AuthController extends Controller
|
|||
$user->{$updatedAttribute} = $newUserData->{$updatedAttribute};
|
||||
$user->save();
|
||||
|
||||
return \Response::json(['message' => 'Successfully updated this user!'], 200);
|
||||
return response()->json(['message' => 'Successfully updated this user!'], 200);
|
||||
}
|
||||
|
||||
protected function loginRedirect($user, $rememberMe = true)
|
||||
{
|
||||
Auth::login($user, $rememberMe);
|
||||
|
||||
return redirect('/');
|
||||
return redirect()->to('/');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use View;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class ContentController extends Controller
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use View;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Models\Image;
|
||||
use Config;
|
||||
use Redirect;
|
||||
use Response;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
class ImagesController extends Controller
|
||||
{
|
||||
|
@ -41,13 +41,13 @@ class ImagesController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
|
||||
$response = response('', 200);
|
||||
$response = response()->noContent(200);
|
||||
$filename = $image->getFile($coverType['id']);
|
||||
|
||||
if (! is_file($filename)) {
|
||||
$redirect = url('/images/icons/profile_'.Image::$ImageTypes[$coverType['id']]['name'].'.png');
|
||||
|
||||
return redirect($redirect);
|
||||
return redirect()->to($redirect);
|
||||
}
|
||||
|
||||
if (config('app.sendfile')) {
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Models\Email;
|
||||
use App\Models\EmailSubscription;
|
||||
use Auth;
|
||||
use DB;
|
||||
use View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class NotificationsController extends Controller
|
||||
{
|
||||
|
@ -33,36 +34,36 @@ class NotificationsController extends Controller
|
|||
* @param $emailKey
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function getEmailClick($emailKey)
|
||||
public function getEmailClick(Request $request, $emailKey)
|
||||
{
|
||||
/** @var Email $email */
|
||||
$email = Email::findOrFail($emailKey);
|
||||
|
||||
DB::transaction(function () use ($email) {
|
||||
$email->emailClicks()->create(['ip_address' => \Request::ip()]);
|
||||
$email->emailClicks()->create(['ip_address' => $request->ip()]);
|
||||
$email->notification->is_read = true;
|
||||
$email->notification->save();
|
||||
});
|
||||
|
||||
return redirect($email->getActivity()->url);
|
||||
return redirect()->to($email->getActivity()->url);
|
||||
}
|
||||
|
||||
public function getEmailUnsubscribe($subscriptionKey)
|
||||
public function getEmailUnsubscribe(Request $request, $subscriptionKey)
|
||||
{
|
||||
/** @var EmailSubscription $subscription */
|
||||
$subscription = EmailSubscription::findOrFail($subscriptionKey);
|
||||
$subscription->delete();
|
||||
|
||||
if (Auth::check() && $subscription->user->id === Auth::user()->id) {
|
||||
if ($request->user() && $subscription->user->id === $request->user()->id) {
|
||||
return redirect(route('account:settings', [
|
||||
'slug' => $subscription->user->slug,
|
||||
'unsubscribedMessageKey' => $subscription->activity_type,
|
||||
]), 303);
|
||||
]), );
|
||||
} else {
|
||||
return redirect(route('email:confirm-unsubscribed', [
|
||||
'unsubscribedUser' => $subscription->user->display_name,
|
||||
'unsubscribedMessageKey' => $subscription->activity_type,
|
||||
]), 303);
|
||||
]), );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Models\Playlist;
|
||||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use App\PlaylistDownloader;
|
||||
use Auth;
|
||||
use Redirect;
|
||||
use View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class PlaylistsController extends Controller
|
||||
{
|
||||
|
@ -36,10 +37,10 @@ class PlaylistsController extends Controller
|
|||
return view('playlists.index');
|
||||
}
|
||||
|
||||
public function getPlaylist($id, $slug)
|
||||
public function getPlaylist(Request $request, $id, $slug)
|
||||
{
|
||||
$playlist = Playlist::find($id);
|
||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||
if (! $playlist || ! $playlist->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
@ -50,20 +51,20 @@ class PlaylistsController extends Controller
|
|||
return view('playlists.show');
|
||||
}
|
||||
|
||||
public function getShortlink($id)
|
||||
public function getShortlink(Request $request, $id)
|
||||
{
|
||||
$playlist = Playlist::find($id);
|
||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||
if (! $playlist || ! $playlist->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
|
||||
}
|
||||
|
||||
public function getDownload($id, $extension)
|
||||
public function getDownload(Request $request, $id, $extension)
|
||||
{
|
||||
$playlist = Playlist::with('tracks', 'tracks.trackFiles', 'user', 'tracks.album')->find($id);
|
||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||
if (! $playlist || ! $playlist->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
@ -88,6 +89,6 @@ class PlaylistsController extends Controller
|
|||
|
||||
ResourceLogItem::logItem('playlist', $id, ResourceLogItem::DOWNLOAD, $format['index']);
|
||||
$downloader = new PlaylistDownloader($playlist, $formatName);
|
||||
$downloader->download(Auth::user());
|
||||
$downloader->download($request->user());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use View;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class StatsController extends Controller
|
||||
{
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use App\Models\ResourceLogItem;
|
||||
use App\Models\Track;
|
||||
use App\Models\TrackFile;
|
||||
use Auth;
|
||||
use Config;
|
||||
use Illuminate\Http\Request;
|
||||
use Redirect;
|
||||
use Response;
|
||||
use View;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class TracksController extends Controller
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ class TracksController extends Controller
|
|||
return view('tracks.index');
|
||||
}
|
||||
|
||||
public function getEmbed($id)
|
||||
public function getEmbed(Request $request, $id)
|
||||
{
|
||||
$track = Track
|
||||
::whereId($id)
|
||||
|
@ -50,7 +50,7 @@ class TracksController extends Controller
|
|||
'genre'
|
||||
)->first();
|
||||
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class TracksController extends Controller
|
|||
->userDetails()
|
||||
->first();
|
||||
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
@ -110,13 +110,13 @@ class TracksController extends Controller
|
|||
'html' => '<iframe src="'.action('TracksController@getEmbed', ['id' => $track->id]).'" width="100%" height="150" allowTransparency="true" frameborder="0" seamless allowfullscreen></iframe>',
|
||||
];
|
||||
|
||||
return Response::json($output);
|
||||
return response()->json($output);
|
||||
}
|
||||
|
||||
public function getTrack($id, $slug)
|
||||
public function getTrack(Request $request, $id, $slug)
|
||||
{
|
||||
$track = Track::find($id);
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
@ -132,26 +132,26 @@ class TracksController extends Controller
|
|||
return $this->getTrack($id, $slug);
|
||||
}
|
||||
|
||||
public function getShortlink($id)
|
||||
public function getShortlink(Request $request, $id)
|
||||
{
|
||||
$track = Track::find($id);
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
|
||||
}
|
||||
|
||||
public function getStream($id, $extension)
|
||||
public function getStream(Request $request, $id, $extension)
|
||||
{
|
||||
$track = Track::find($id);
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
||||
|
||||
$response = response('', 200);
|
||||
$response = response()->noContent(200);
|
||||
$filename = $trackFile->getFile();
|
||||
|
||||
if (! file_exists($filename)) {
|
||||
|
@ -179,17 +179,17 @@ class TracksController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function getDownload($id, $extension)
|
||||
public function getDownload(Request $request, $id, $extension)
|
||||
{
|
||||
$track = Track::find($id);
|
||||
if (! $track || ! $track->canView(Auth::user())) {
|
||||
if (! $track || ! $track->canView($request->user())) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
|
||||
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $trackFile->getFormat()['index']);
|
||||
|
||||
$response = response('', 200);
|
||||
$response = response()->noContent(200);
|
||||
$filename = $trackFile->getFile();
|
||||
|
||||
if (config('app.sendfile')) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use View;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class UploaderController extends Controller
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Gate;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class Authorize
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace App\Http\Middleware;
|
|||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DisabledAccountCheck
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ class JsonExceptions
|
|||
try {
|
||||
$response = $next($request);
|
||||
} catch (HttpException $e) {
|
||||
return \Response::json([
|
||||
return response()->json([
|
||||
'message' => $e->getMessage(),
|
||||
], $e->getStatusCode());
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class RedirectIfAuthenticated
|
|||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
return redirect()->to(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\Genre;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use SerializesModels;
|
||||
|
||||
class DeleteGenre extends Job implements ShouldQueue
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\ShowSong;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use SerializesModels;
|
||||
|
||||
class DeleteShowSong extends Job implements ShouldQueue
|
||||
|
|
|
@ -25,13 +25,13 @@ use App\Exceptions\InvalidEncodeOptionsException;
|
|||
use App\Models\Track;
|
||||
use App\Models\TrackFile;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use DB;
|
||||
use File;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App;
|
||||
use DB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
abstract class Job
|
||||
{
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace App\Jobs;
|
|||
|
||||
use App\Contracts\Searchable;
|
||||
use App\Jobs\Job;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use SerializesModels;
|
||||
|
||||
class UpdateSearchIndexForEntity extends Job implements ShouldQueue
|
||||
|
|
|
@ -22,12 +22,12 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\Genre;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,11 +22,11 @@ namespace App\Jobs;
|
|||
|
||||
use App\Models\ShowSong;
|
||||
use App\Models\Track;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ use App\Models\Comment;
|
|||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Minishlink\WebPush\WebPush;
|
||||
|
||||
class NativeDriver extends AbstractDriver
|
||||
|
|
|
@ -30,8 +30,8 @@ use App\Models\Playlist;
|
|||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Log;
|
||||
use Mail;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class PonyfmDriver extends AbstractDriver
|
||||
{
|
||||
|
|
|
@ -24,10 +24,10 @@ use App\Models\Album;
|
|||
use App\Models\Playlist;
|
||||
use App\Models\Track;
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Elasticsearch\Client;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Search
|
||||
{
|
||||
|
|
|
@ -557,7 +557,7 @@ class ZipStream
|
|||
*/
|
||||
public static function getRelativePath($path)
|
||||
{
|
||||
$path = preg_replace("#/+\.?/+#", '/', str_replace('\\', '/', $path));
|
||||
$path = preg_replace('#/+\\.?/+#', '/', str_replace('\\', '/', $path));
|
||||
$dirs = explode('/', rtrim(preg_replace('#^(?:\./)+#', '', $path), '/'));
|
||||
|
||||
$offset = 0;
|
||||
|
|
|
@ -1427,15 +1427,15 @@ if (! function_exists('IsValidURL')) {
|
|||
if ($parts = safe_parse_url($url)) {
|
||||
if (($parts['scheme'] != 'http') && ($parts['scheme'] != 'https') && ($parts['scheme'] != 'ftp') && ($parts['scheme'] != 'gopher')) {
|
||||
return false;
|
||||
} elseif (! preg_match("#^[[:alnum:]]([-.]?[0-9a-z])*\.[a-z]{2,3}#i$", $parts['host'], $regs) && ! preg_match('#^[0-9]{1,3}(\.[0-9]{1,3}){3}$#', $parts['host'])) {
|
||||
} elseif (! preg_match('#^[[:alnum:]]([-.]?[0-9a-z])*\\.[a-z]{2,3}#i$', $parts['host'], $regs) && ! preg_match('#^[0-9]{1,3}(\.[0-9]{1,3}){3}$#', $parts['host'])) {
|
||||
return false;
|
||||
} elseif (! preg_match("#^([[:alnum:]-]|[\_])*$#i", $parts['user'], $regs)) {
|
||||
} elseif (! preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['user'], $regs)) {
|
||||
return false;
|
||||
} elseif (! preg_match("#^([[:alnum:]-]|[\_])*$#i", $parts['pass'], $regs)) {
|
||||
} elseif (! preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['pass'], $regs)) {
|
||||
return false;
|
||||
} elseif (! preg_match("#^[[:alnum:]/_\.@~-]*$#i", $parts['path'], $regs)) {
|
||||
} elseif (! preg_match('#^[[:alnum:]/_\\.@~-]*$#i', $parts['path'], $regs)) {
|
||||
return false;
|
||||
} elseif (! preg_match("#^[[:alnum:]?&=+:;_()%#/,\.-]*$#i", $parts['query'], $regs)) {
|
||||
} elseif (! preg_match('#^[[:alnum:]?&=+:;_()%#/,\\.-]*$#i', $parts['query'], $regs)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -59,7 +59,7 @@ class Activity extends Model
|
|||
use SoftDeletes;
|
||||
|
||||
public $timestamps = false;
|
||||
protected $dates = ['created_at'];
|
||||
|
||||
protected $fillable = ['created_at', 'user_id', 'activity_type', 'resource_type', 'resource_id'];
|
||||
protected $appends = ['url', 'thumbnail_url', 'human_friendly_resource_type'];
|
||||
protected $casts = [
|
||||
|
|
|
@ -27,17 +27,17 @@ use App\Exceptions\TrackFileNotFoundException;
|
|||
use App\Traits\IndexedInElasticsearchTrait;
|
||||
use App\Traits\SlugTrait;
|
||||
use App\Traits\TrackCollection;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Exception;
|
||||
use Gate;
|
||||
use Helpers;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
|
||||
/**
|
||||
|
@ -126,8 +126,6 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
return $query;
|
||||
}
|
||||
|
||||
protected $table = 'albums';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
@ -150,7 +148,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function tracks()
|
||||
{
|
||||
return $this->hasMany(Track::class)->orderBy('track_number', 'asc');
|
||||
return $this->hasMany(Track::class)->orderBy('track_number');
|
||||
}
|
||||
|
||||
public function trackFiles()
|
||||
|
@ -162,7 +160,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class)->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function activities():MorphMany
|
||||
|
|
|
@ -49,8 +49,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Announcement extends Model
|
||||
{
|
||||
protected $table = 'announcements';
|
||||
|
||||
protected $casts = [
|
||||
'links' => 'array',
|
||||
'tracks' => 'array',
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Contracts\Commentable;
|
||||
use DB;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* App\Models\Comment.
|
||||
|
@ -70,8 +70,6 @@ class Comment extends Model
|
|||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'comments';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
|
|
@ -47,7 +47,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class Favourite extends Model
|
||||
{
|
||||
protected $table = 'favourites';
|
||||
public $timestamps = false;
|
||||
|
||||
/*
|
||||
|
|
|
@ -42,8 +42,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
*/
|
||||
class Follower extends Model
|
||||
{
|
||||
protected $table = 'followers';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function follower():BelongsTo
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Traits\SlugTrait;
|
||||
use DB;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
|
||||
/**
|
||||
|
@ -60,8 +60,6 @@ class Genre extends Model
|
|||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'genres';
|
||||
|
||||
protected $fillable = ['name', 'slug'];
|
||||
protected $appends = ['track_count', 'url'];
|
||||
protected $hidden = ['trackCountRelation'];
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Config;
|
||||
use External;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
|
@ -165,8 +165,6 @@ class Image extends Model
|
|||
chmod($path, 0644);
|
||||
}
|
||||
|
||||
protected $table = 'images';
|
||||
|
||||
public function getUrl($type = self::NORMAL)
|
||||
{
|
||||
$type = self::$ImageTypes[$type];
|
||||
|
|
|
@ -41,5 +41,4 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class License extends Model
|
||||
{
|
||||
protected $table = 'licenses';
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class Notification extends Model
|
|||
->where('notifications.user_id', $user->id)
|
||||
->whereNull('activities.deleted_at')
|
||||
->select('*', 'notifications.id as id')
|
||||
->orderBy('activities.created_at', 'DESC');
|
||||
->orderByDesc('activities.created_at');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*/
|
||||
class PinnedPlaylist extends Model
|
||||
{
|
||||
protected $table = 'pinned_playlists';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
|
|
@ -27,15 +27,15 @@ use App\Exceptions\TrackFileNotFoundException;
|
|||
use App\Traits\IndexedInElasticsearchTrait;
|
||||
use App\Traits\SlugTrait;
|
||||
use App\Traits\TrackCollection;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Helpers;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
|
||||
/**
|
||||
|
@ -94,8 +94,6 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
protected $elasticsearchType = 'playlist';
|
||||
|
||||
protected $table = 'playlists';
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
|
@ -244,7 +242,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
->withTimestamps();
|
||||
|
||||
if ($ordered) {
|
||||
$query = $query->orderBy('position', 'asc');
|
||||
$query = $query->orderBy('position');
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
@ -269,7 +267,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class)->orderByDesc('created_at');
|
||||
}
|
||||
|
||||
public function pins()
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
/**
|
||||
* App\Models\ResourceLogItem.
|
||||
|
@ -51,9 +51,7 @@ use Request;
|
|||
*/
|
||||
class ResourceLogItem extends Model
|
||||
{
|
||||
protected $table = 'resource_log_items';
|
||||
public $timestamps = false;
|
||||
protected $dates = ['created_at'];
|
||||
|
||||
const VIEW = 1;
|
||||
const DOWNLOAD = 2;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue