From 5ff04ff08ddeffa57900f8f8ef09f15da57d0446 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Thu, 31 Dec 2015 16:12:30 -0800 Subject: [PATCH] Moved all database models into their own namespace. --- app/Commands/AddTrackToPlaylistCommand.php | 4 +- app/Commands/CreateAlbumCommand.php | 4 +- app/Commands/CreateCommentCommand.php | 10 ++-- app/Commands/CreatePlaylistCommand.php | 2 +- app/Commands/DeleteAlbumCommand.php | 2 +- app/Commands/DeleteGenreCommand.php | 2 +- app/Commands/DeletePlaylistCommand.php | 2 +- app/Commands/DeleteTrackCommand.php | 2 +- app/Commands/EditAlbumCommand.php | 4 +- app/Commands/EditPlaylistCommand.php | 4 +- app/Commands/EditTrackCommand.php | 10 ++-- app/Commands/RenameGenreCommand.php | 2 +- app/Commands/SaveAccountSettingsCommand.php | 2 +- app/Commands/ToggleFavouriteCommand.php | 4 +- app/Commands/ToggleFollowingCommand.php | 4 +- app/Commands/UploadTrackCommand.php | 14 +++--- app/Console/Commands/ClassifyMLPMA.php | 6 +-- app/Console/Commands/ClearTrackCache.php | 4 +- app/Console/Commands/FixYearZeroLogs.php | 2 +- app/Console/Commands/ImportMLPMA.php | 10 ++-- .../Commands/MergeDuplicateAccounts.php | 22 ++++----- app/Console/Commands/MigrateOldData.php | 4 +- .../PublishUnclassifiedMlpmaTracks.php | 4 +- app/Console/Commands/RebuildArtists.php | 2 +- app/Console/Commands/RebuildFilesizes.php | 2 +- app/Console/Commands/RebuildTags.php | 2 +- app/Console/Commands/RebuildTrackCache.php | 4 +- app/Console/Commands/RefreshCache.php | 2 +- app/Http/Controllers/AlbumsController.php | 4 +- .../Api/Mobile/TracksController.php | 2 +- .../Controllers/Api/V1/TracksController.php | 4 +- .../Controllers/Api/Web/AlbumsController.php | 8 ++-- .../Controllers/Api/Web/ArtistsController.php | 14 +++--- .../Api/Web/CommentsController.php | 2 +- .../Api/Web/DashboardController.php | 2 +- .../Api/Web/FavouritesController.php | 8 ++-- .../Controllers/Api/Web/GenresController.php | 2 +- .../Controllers/Api/Web/ImagesController.php | 2 +- .../Api/Web/PlaylistsController.php | 8 ++-- .../Api/Web/TaxonomiesController.php | 8 ++-- .../Controllers/Api/Web/TracksController.php | 4 +- app/Http/Controllers/ArtistsController.php | 2 +- app/Http/Controllers/AuthController.php | 2 +- app/Http/Controllers/ImagesController.php | 2 +- app/Http/Controllers/PlaylistsController.php | 6 +-- app/Http/Controllers/TracksController.php | 6 +-- app/Http/Middleware/AuthenticateOAuth.php | 2 +- app/Jobs/DeleteGenre.php | 4 +- app/Jobs/EncodeTrackFile.php | 4 +- app/Library/PFMAuth.php | 2 +- app/{ => Models}/Album.php | 14 +++--- app/{ => Models}/Comment.php | 12 ++--- app/{ => Models}/Favourite.php | 10 ++-- app/{ => Models}/Follower.php | 2 +- app/{ => Models}/Genre.php | 2 +- app/{ => Models}/Image.php | 2 +- app/{ => Models}/License.php | 2 +- app/{ => Models}/PinnedPlaylist.php | 6 +-- app/{ => Models}/Playlist.php | 12 ++--- app/{ => Models}/ResourceLogItem.php | 2 +- app/{ => Models}/ResourceUser.php | 2 +- app/{ => Models}/Role.php | 2 +- app/{ => Models}/ShowSong.php | 2 +- app/{ => Models}/Track.php | 22 ++++----- app/{ => Models}/TrackFile.php | 4 +- app/{ => Models}/TrackType.php | 2 +- app/{ => Models}/User.php | 10 ++-- app/Policies/GenrePolicy.php | 4 +- app/Policies/TrackPolicy.php | 4 +- app/Providers/AuthServiceProvider.php | 6 +-- app/Traits/TrackCollection.php | 2 +- config/auth.php | 2 +- config/services.php | 2 +- database/factories/ModelFactory.php | 8 ++-- .../2013_09_23_031316_create_track_hashes.php | 2 +- .../2014_05_28_071738_update_track_hash.php | 2 +- ..._05_25_011121_create_track_files_table.php | 2 +- ...8_162655_AddTrackFilesForDeletedTracks.php | 2 +- ...0_update_model_namespaces_in_revisions.php | 47 +++++++++++++++++++ resources/views/shared/_app_layout.blade.php | 2 +- resources/views/tracks/embed.blade.php | 2 +- tests/ApiAuthTest.php | 2 +- tests/ApiTest.php | 4 +- tests/TestCase.php | 2 +- 84 files changed, 242 insertions(+), 195 deletions(-) rename app/{ => Models}/Album.php (95%) rename app/{ => Models}/Comment.php (86%) rename app/{ => Models}/Favourite.php (86%) rename app/{ => Models}/Follower.php (96%) rename app/{ => Models}/Genre.php (98%) rename app/{ => Models}/Image.php (99%) rename app/{ => Models}/License.php (96%) rename app/{ => Models}/PinnedPlaylist.php (85%) rename app/{ => Models}/Playlist.php (95%) rename app/{ => Models}/ResourceLogItem.php (99%) rename app/{ => Models}/ResourceUser.php (97%) rename app/{ => Models}/Role.php (96%) rename app/{ => Models}/ShowSong.php (96%) rename app/{ => Models}/Track.php (97%) rename app/{ => Models}/TrackFile.php (97%) rename app/{ => Models}/TrackType.php (96%) rename app/{ => Models}/User.php (93%) create mode 100644 database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php diff --git a/app/Commands/AddTrackToPlaylistCommand.php b/app/Commands/AddTrackToPlaylistCommand.php index d894d0c1..314e6ce2 100644 --- a/app/Commands/AddTrackToPlaylistCommand.php +++ b/app/Commands/AddTrackToPlaylistCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; diff --git a/app/Commands/CreateAlbumCommand.php b/app/Commands/CreateAlbumCommand.php index bc772f10..c16b6762 100644 --- a/app/Commands/CreateAlbumCommand.php +++ b/app/Commands/CreateAlbumCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Album; +use Poniverse\Ponyfm\Models\Image; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/CreateCommentCommand.php b/app/Commands/CreateCommentCommand.php index ceb01af4..ade69196 100644 --- a/app/Commands/CreateCommentCommand.php +++ b/app/Commands/CreateCommentCommand.php @@ -20,11 +20,11 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Comment; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Album; +use Poniverse\Ponyfm\Models\Comment; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/CreatePlaylistCommand.php b/app/Commands/CreatePlaylistCommand.php index 69a731a9..51c9c8f7 100644 --- a/app/Commands/CreatePlaylistCommand.php +++ b/app/Commands/CreatePlaylistCommand.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Playlist; +use Poniverse\Ponyfm\Models\Playlist; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/DeleteAlbumCommand.php b/app/Commands/DeleteAlbumCommand.php index 1e2306f8..d8be88aa 100644 --- a/app/Commands/DeleteAlbumCommand.php +++ b/app/Commands/DeleteAlbumCommand.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Illuminate\Support\Facades\Auth; class DeleteAlbumCommand extends CommandBase diff --git a/app/Commands/DeleteGenreCommand.php b/app/Commands/DeleteGenreCommand.php index ae9cee0e..0ce27885 100644 --- a/app/Commands/DeleteGenreCommand.php +++ b/app/Commands/DeleteGenreCommand.php @@ -22,7 +22,7 @@ namespace Poniverse\Ponyfm\Commands; use Gate; use Illuminate\Foundation\Bus\DispatchesJobs; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Poniverse\Ponyfm\Jobs\DeleteGenre; use Validator; diff --git a/app/Commands/DeletePlaylistCommand.php b/app/Commands/DeletePlaylistCommand.php index eb5c2cb1..7f20cdca 100644 --- a/app/Commands/DeletePlaylistCommand.php +++ b/app/Commands/DeletePlaylistCommand.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Playlist; +use Poniverse\Ponyfm\Models\Playlist; use Illuminate\Support\Facades\Auth; class DeletePlaylistCommand extends CommandBase diff --git a/app/Commands/DeleteTrackCommand.php b/app/Commands/DeleteTrackCommand.php index fd18a7d9..ee8ceea2 100644 --- a/app/Commands/DeleteTrackCommand.php +++ b/app/Commands/DeleteTrackCommand.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; class DeleteTrackCommand extends CommandBase { diff --git a/app/Commands/EditAlbumCommand.php b/app/Commands/EditAlbumCommand.php index 2bfadeea..fd8a68cf 100644 --- a/app/Commands/EditAlbumCommand.php +++ b/app/Commands/EditAlbumCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Album; +use Poniverse\Ponyfm\Models\Image; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/EditPlaylistCommand.php b/app/Commands/EditPlaylistCommand.php index 796b4511..c4136364 100644 --- a/app/Commands/EditPlaylistCommand.php +++ b/app/Commands/EditPlaylistCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\PinnedPlaylist; -use Poniverse\Ponyfm\Playlist; +use Poniverse\Ponyfm\Models\PinnedPlaylist; +use Poniverse\Ponyfm\Models\Playlist; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/EditTrackCommand.php b/app/Commands/EditTrackCommand.php index dae10b6d..10f42a04 100644 --- a/app/Commands/EditTrackCommand.php +++ b/app/Commands/EditTrackCommand.php @@ -20,11 +20,11 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackType; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Album; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackType; +use Poniverse\Ponyfm\Models\User; use Auth; use DB; diff --git a/app/Commands/RenameGenreCommand.php b/app/Commands/RenameGenreCommand.php index afbe5d9d..46d2f53a 100644 --- a/app/Commands/RenameGenreCommand.php +++ b/app/Commands/RenameGenreCommand.php @@ -22,7 +22,7 @@ namespace Poniverse\Ponyfm\Commands; use Gate; use Illuminate\Support\Str; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Validator; class RenameGenreCommand extends CommandBase diff --git a/app/Commands/SaveAccountSettingsCommand.php b/app/Commands/SaveAccountSettingsCommand.php index 9a285c25..2c535125 100644 --- a/app/Commands/SaveAccountSettingsCommand.php +++ b/app/Commands/SaveAccountSettingsCommand.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Image; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; diff --git a/app/Commands/ToggleFavouriteCommand.php b/app/Commands/ToggleFavouriteCommand.php index 4e97ac3f..c7bff8e3 100644 --- a/app/Commands/ToggleFavouriteCommand.php +++ b/app/Commands/ToggleFavouriteCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Favourite; -use Poniverse\Ponyfm\ResourceUser; +use Poniverse\Ponyfm\Models\Favourite; +use Poniverse\Ponyfm\Models\ResourceUser; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; diff --git a/app/Commands/ToggleFollowingCommand.php b/app/Commands/ToggleFollowingCommand.php index ff2c5d66..fda5aa13 100644 --- a/app/Commands/ToggleFollowingCommand.php +++ b/app/Commands/ToggleFollowingCommand.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Commands; -use Poniverse\Ponyfm\Follower; -use Poniverse\Ponyfm\ResourceUser; +use Poniverse\Ponyfm\Models\Follower; +use Poniverse\Ponyfm\Models\ResourceUser; use Illuminate\Support\Facades\Auth; class ToggleFollowingCommand extends CommandBase diff --git a/app/Commands/UploadTrackCommand.php b/app/Commands/UploadTrackCommand.php index 4c09f97c..59b53cbe 100644 --- a/app/Commands/UploadTrackCommand.php +++ b/app/Commands/UploadTrackCommand.php @@ -25,18 +25,18 @@ use Config; use getID3; use Illuminate\Foundation\Bus\DispatchesJobs; use Input; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Poniverse\Ponyfm\Exceptions\InvalidEncodeOptionsException; -use Poniverse\Ponyfm\Genre; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Genre; +use Poniverse\Ponyfm\Models\Image; use Poniverse\Ponyfm\Jobs\EncodeTrackFile; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackFile; use AudioCache; use File; use Illuminate\Support\Str; -use Poniverse\Ponyfm\TrackType; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\TrackType; +use Poniverse\Ponyfm\Models\User; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; diff --git a/app/Console/Commands/ClassifyMLPMA.php b/app/Console/Commands/ClassifyMLPMA.php index 88f9ec98..926c2988 100644 --- a/app/Console/Commands/ClassifyMLPMA.php +++ b/app/Console/Commands/ClassifyMLPMA.php @@ -20,9 +20,9 @@ namespace Poniverse\Ponyfm\Console\Commands; -use Poniverse\Ponyfm\ShowSong; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackType; +use Poniverse\Ponyfm\Models\ShowSong; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackType; use DB; use Illuminate\Console\Command; use Illuminate\Support\Str; diff --git a/app/Console/Commands/ClearTrackCache.php b/app/Console/Commands/ClearTrackCache.php index 5c5feea1..a807e98c 100644 --- a/app/Console/Commands/ClearTrackCache.php +++ b/app/Console/Commands/ClearTrackCache.php @@ -24,7 +24,7 @@ use Carbon\Carbon; use File; use Illuminate\Console\Command; use Illuminate\Support\Facades\Cache; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\TrackFile; class ClearTrackCache extends Command { @@ -108,4 +108,4 @@ class ClearTrackCache extends Command } } -} \ No newline at end of file +} diff --git a/app/Console/Commands/FixYearZeroLogs.php b/app/Console/Commands/FixYearZeroLogs.php index 73912193..3e1cc4b1 100644 --- a/app/Console/Commands/FixYearZeroLogs.php +++ b/app/Console/Commands/FixYearZeroLogs.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Console\Commands; use Carbon\Carbon; -use Poniverse\Ponyfm\ResourceLogItem; +use Poniverse\Ponyfm\Models\ResourceLogItem; use Illuminate\Console\Command; class FixYearZeroLogs extends Command diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index d6907962..cfa55af5 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -20,12 +20,12 @@ namespace Poniverse\Ponyfm\Console\Commands; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Poniverse\Ponyfm\Commands\UploadTrackCommand; -use Poniverse\Ponyfm\Genre; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Genre; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; use Auth; use Carbon\Carbon; use Config; diff --git a/app/Console/Commands/MergeDuplicateAccounts.php b/app/Console/Commands/MergeDuplicateAccounts.php index 29136c01..0a400a55 100644 --- a/app/Console/Commands/MergeDuplicateAccounts.php +++ b/app/Console/Commands/MergeDuplicateAccounts.php @@ -24,17 +24,17 @@ use Carbon\Carbon; use DB; use Illuminate\Console\Command; use Illuminate\Support\Collection; -use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Comment; -use Poniverse\Ponyfm\Favourite; -use Poniverse\Ponyfm\Follower; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\PinnedPlaylist; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\ResourceLogItem; -use Poniverse\Ponyfm\ResourceUser; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Album; +use Poniverse\Ponyfm\Models\Comment; +use Poniverse\Ponyfm\Models\Favourite; +use Poniverse\Ponyfm\Models\Follower; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\PinnedPlaylist; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\ResourceLogItem; +use Poniverse\Ponyfm\Models\ResourceUser; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; class MergeDuplicateAccounts extends Command { diff --git a/app/Console/Commands/MigrateOldData.php b/app/Console/Commands/MigrateOldData.php index a34d2ef8..166be24c 100644 --- a/app/Console/Commands/MigrateOldData.php +++ b/app/Console/Commands/MigrateOldData.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Console\Commands; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\ResourceLogItem; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\ResourceLogItem; use DB; use Exception; use Illuminate\Console\Command; diff --git a/app/Console/Commands/PublishUnclassifiedMlpmaTracks.php b/app/Console/Commands/PublishUnclassifiedMlpmaTracks.php index 215a354d..bf3095b5 100644 --- a/app/Console/Commands/PublishUnclassifiedMlpmaTracks.php +++ b/app/Console/Commands/PublishUnclassifiedMlpmaTracks.php @@ -23,8 +23,8 @@ namespace Poniverse\Ponyfm\Console\Commands; use Carbon\Carbon; use DB; use Illuminate\Console\Command; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackType; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackType; class PublishUnclassifiedMlpmaTracks extends Command { diff --git a/app/Console/Commands/RebuildArtists.php b/app/Console/Commands/RebuildArtists.php index 3c540711..84e74d78 100644 --- a/app/Console/Commands/RebuildArtists.php +++ b/app/Console/Commands/RebuildArtists.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Console\Commands; use Illuminate\Console\Command; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\User; class RebuildArtists extends Command { diff --git a/app/Console/Commands/RebuildFilesizes.php b/app/Console/Commands/RebuildFilesizes.php index 8b0e99ae..e3236b9a 100644 --- a/app/Console/Commands/RebuildFilesizes.php +++ b/app/Console/Commands/RebuildFilesizes.php @@ -22,7 +22,7 @@ namespace Poniverse\Ponyfm\Console\Commands; use File; use Illuminate\Console\Command; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\TrackFile; class RebuildFilesizes extends Command { diff --git a/app/Console/Commands/RebuildTags.php b/app/Console/Commands/RebuildTags.php index efdd9588..3898ed4a 100644 --- a/app/Console/Commands/RebuildTags.php +++ b/app/Console/Commands/RebuildTags.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Console\Commands; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Console\Command; class RebuildTags extends Command diff --git a/app/Console/Commands/RebuildTrackCache.php b/app/Console/Commands/RebuildTrackCache.php index 5b4386d1..67e4727d 100644 --- a/app/Console/Commands/RebuildTrackCache.php +++ b/app/Console/Commands/RebuildTrackCache.php @@ -24,8 +24,8 @@ use File; use Illuminate\Console\Command; use Illuminate\Foundation\Bus\DispatchesJobs; use Poniverse\Ponyfm\Jobs\EncodeTrackFile; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackFile; class RebuildTrackCache extends Command { diff --git a/app/Console/Commands/RefreshCache.php b/app/Console/Commands/RefreshCache.php index 54e0360f..19b985f6 100644 --- a/app/Console/Commands/RefreshCache.php +++ b/app/Console/Commands/RefreshCache.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Console\Commands; -use Poniverse\Ponyfm\ResourceLogItem; +use Poniverse\Ponyfm\Models\ResourceLogItem; use DB; use Illuminate\Console\Command; diff --git a/app/Http/Controllers/AlbumsController.php b/app/Http/Controllers/AlbumsController.php index df372260..d966aa37 100644 --- a/app/Http/Controllers/AlbumsController.php +++ b/app/Http/Controllers/AlbumsController.php @@ -22,9 +22,9 @@ namespace Poniverse\Ponyfm\Http\Controllers; use Poniverse\Ponyfm\AlbumDownloader; use App; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Poniverse\Ponyfm\ResourceLogItem; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Support\Facades\Redirect; use View; diff --git a/app/Http/Controllers/Api/Mobile/TracksController.php b/app/Http/Controllers/Api/Mobile/TracksController.php index 96a70fd0..4f1a96f6 100644 --- a/app/Http/Controllers/Api/Mobile/TracksController.php +++ b/app/Http/Controllers/Api/Mobile/TracksController.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Mobile; use Poniverse\Ponyfm\Http\Controllers\Controller; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Response; class TracksController extends Controller diff --git a/app/Http/Controllers/Api/V1/TracksController.php b/app/Http/Controllers/Api/V1/TracksController.php index 9c1bd4cb..aeba018b 100644 --- a/app/Http/Controllers/Api/V1/TracksController.php +++ b/app/Http/Controllers/Api/V1/TracksController.php @@ -22,8 +22,8 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\V1; use Poniverse\Ponyfm\Commands\UploadTrackCommand; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\Track; use Response; class TracksController extends ApiControllerBase diff --git a/app/Http/Controllers/Api/Web/AlbumsController.php b/app/Http/Controllers/Api/Web/AlbumsController.php index 530a1992..fb61be53 100644 --- a/app/Http/Controllers/Api/Web/AlbumsController.php +++ b/app/Http/Controllers/Api/Web/AlbumsController.php @@ -22,18 +22,18 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Facades\File; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Poniverse\Ponyfm\Commands\CreateAlbumCommand; use Poniverse\Ponyfm\Commands\DeleteAlbumCommand; use Poniverse\Ponyfm\Commands\EditAlbumCommand; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Image; use Poniverse\Ponyfm\Jobs\EncodeTrackFile; -use Poniverse\Ponyfm\ResourceLogItem; +use Poniverse\Ponyfm\Models\ResourceLogItem; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; class AlbumsController extends ApiControllerBase { diff --git a/app/Http/Controllers/Api/Web/ArtistsController.php b/app/Http/Controllers/Api/Web/ArtistsController.php index b54044ae..43f63f29 100644 --- a/app/Http/Controllers/Api/Web/ArtistsController.php +++ b/app/Http/Controllers/Api/Web/ArtistsController.php @@ -21,12 +21,12 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use Poniverse\Ponyfm\Album; -use Poniverse\Ponyfm\Comment; -use Poniverse\Ponyfm\Favourite; +use Poniverse\Ponyfm\Models\Comment; +use Poniverse\Ponyfm\Models\Favourite; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; use Cover; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Input; @@ -59,10 +59,10 @@ class ArtistsController extends ApiControllerBase $albums = []; foreach ($favs as $fav) { - if ($fav->type == 'Poniverse\Ponyfm\Track') { + if ($fav->type == 'Poniverse\Ponyfm\Models\Track') { $tracks[] = Track::mapPublicTrackSummary($fav->track); } else { - if ($fav->type == 'Poniverse\Ponyfm\Album') { + if ($fav->type == 'Poniverse\Ponyfm\Models\Album') { $albums[] = Album::mapPublicAlbumSummary($fav->album); } } diff --git a/app/Http/Controllers/Api/Web/CommentsController.php b/app/Http/Controllers/Api/Web/CommentsController.php index 9bbe7a0b..efbe16ac 100644 --- a/app/Http/Controllers/Api/Web/CommentsController.php +++ b/app/Http/Controllers/Api/Web/CommentsController.php @@ -22,7 +22,7 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use App; use Poniverse\Ponyfm\Commands\CreateCommentCommand; -use Poniverse\Ponyfm\Comment; +use Poniverse\Ponyfm\Models\Comment; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; diff --git a/app/Http/Controllers/Api/Web/DashboardController.php b/app/Http/Controllers/Api/Web/DashboardController.php index d90c1a6c..2ae700ac 100644 --- a/app/Http/Controllers/Api/Web/DashboardController.php +++ b/app/Http/Controllers/Api/Web/DashboardController.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; diff --git a/app/Http/Controllers/Api/Web/FavouritesController.php b/app/Http/Controllers/Api/Web/FavouritesController.php index da412d76..e1eb59f0 100644 --- a/app/Http/Controllers/Api/Web/FavouritesController.php +++ b/app/Http/Controllers/Api/Web/FavouritesController.php @@ -20,12 +20,12 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; -use Poniverse\Ponyfm\Album; +use Poniverse\Ponyfm\Models\Album; use Poniverse\Ponyfm\Commands\ToggleFavouriteCommand; -use Poniverse\Ponyfm\Favourite; +use Poniverse\Ponyfm\Models\Favourite; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; diff --git a/app/Http/Controllers/Api/Web/GenresController.php b/app/Http/Controllers/Api/Web/GenresController.php index 78710baa..1d00b956 100644 --- a/app/Http/Controllers/Api/Web/GenresController.php +++ b/app/Http/Controllers/Api/Web/GenresController.php @@ -23,7 +23,7 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use Input; use Poniverse\Ponyfm\Commands\DeleteGenreCommand; use Poniverse\Ponyfm\Commands\RenameGenreCommand; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; use Response; diff --git a/app/Http/Controllers/Api/Web/ImagesController.php b/app/Http/Controllers/Api/Web/ImagesController.php index 09687024..a7071211 100644 --- a/app/Http/Controllers/Api/Web/ImagesController.php +++ b/app/Http/Controllers/Api/Web/ImagesController.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Image; use Cover; use Illuminate\Support\Facades\Response; diff --git a/app/Http/Controllers/Api/Web/PlaylistsController.php b/app/Http/Controllers/Api/Web/PlaylistsController.php index aac920b3..e3b92e76 100644 --- a/app/Http/Controllers/Api/Web/PlaylistsController.php +++ b/app/Http/Controllers/Api/Web/PlaylistsController.php @@ -26,13 +26,13 @@ use Poniverse\Ponyfm\Commands\CreatePlaylistCommand; use Poniverse\Ponyfm\Commands\DeletePlaylistCommand; use Poniverse\Ponyfm\Commands\EditPlaylistCommand; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\Image; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\ResourceLogItem; +use Poniverse\Ponyfm\Models\Image; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\ResourceLogItem; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; class PlaylistsController extends ApiControllerBase { diff --git a/app/Http/Controllers/Api/Web/TaxonomiesController.php b/app/Http/Controllers/Api/Web/TaxonomiesController.php index a2107bf7..029556ed 100644 --- a/app/Http/Controllers/Api/Web/TaxonomiesController.php +++ b/app/Http/Controllers/Api/Web/TaxonomiesController.php @@ -20,11 +20,11 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; -use Poniverse\Ponyfm\License; -use Poniverse\Ponyfm\ShowSong; -use Poniverse\Ponyfm\TrackType; +use Poniverse\Ponyfm\Models\License; +use Poniverse\Ponyfm\Models\ShowSong; +use Poniverse\Ponyfm\Models\TrackType; use Illuminate\Support\Facades\DB; class TaxonomiesController extends ApiControllerBase diff --git a/app/Http/Controllers/Api/Web/TracksController.php b/app/Http/Controllers/Api/Web/TracksController.php index 78e27950..123387ec 100644 --- a/app/Http/Controllers/Api/Web/TracksController.php +++ b/app/Http/Controllers/Api/Web/TracksController.php @@ -29,8 +29,8 @@ use Poniverse\Ponyfm\Commands\UploadTrackCommand; use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; use Poniverse\Ponyfm\Jobs\EncodeTrackFile; use Poniverse\Ponyfm\ResourceLogItem; -use Poniverse\Ponyfm\TrackFile; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\TrackFile; +use Poniverse\Ponyfm\Models\Track; use Auth; use Input; use Response; diff --git a/app/Http/Controllers/ArtistsController.php b/app/Http/Controllers/ArtistsController.php index 6ecebfed..2365c5a2 100644 --- a/app/Http/Controllers/ArtistsController.php +++ b/app/Http/Controllers/ArtistsController.php @@ -21,7 +21,7 @@ namespace Poniverse\Ponyfm\Http\Controllers; use App; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\User; use View; use Redirect; diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 13c1f8ee..3db072be 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Http\Controllers; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\User; use Auth; use Config; use DB; diff --git a/app/Http/Controllers/ImagesController.php b/app/Http/Controllers/ImagesController.php index 15f8fc3f..7801c878 100644 --- a/app/Http/Controllers/ImagesController.php +++ b/app/Http/Controllers/ImagesController.php @@ -20,7 +20,7 @@ namespace Poniverse\Ponyfm\Http\Controllers; -use Poniverse\Ponyfm\Image; +use Poniverse\Ponyfm\Models\Image; use Config; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Redirect; diff --git a/app/Http/Controllers/PlaylistsController.php b/app/Http/Controllers/PlaylistsController.php index 92655ae2..f0ea6a82 100644 --- a/app/Http/Controllers/PlaylistsController.php +++ b/app/Http/Controllers/PlaylistsController.php @@ -21,9 +21,9 @@ namespace Poniverse\Ponyfm\Http\Controllers; use App; -use Poniverse\Ponyfm\Playlist; -use Poniverse\Ponyfm\ResourceLogItem; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Playlist; +use Poniverse\Ponyfm\Models\ResourceLogItem; +use Poniverse\Ponyfm\Models\Track; use Poniverse\Ponyfm\PlaylistDownloader; use Auth; use Illuminate\Support\Facades\Redirect; diff --git a/app/Http/Controllers/TracksController.php b/app/Http/Controllers/TracksController.php index f56c5450..b51d388e 100644 --- a/app/Http/Controllers/TracksController.php +++ b/app/Http/Controllers/TracksController.php @@ -20,9 +20,9 @@ namespace Poniverse\Ponyfm\Http\Controllers; -use Poniverse\Ponyfm\ResourceLogItem; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\ResourceLogItem; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackFile; use Auth; use Config; use Illuminate\Support\Facades\App; diff --git a/app/Http/Middleware/AuthenticateOAuth.php b/app/Http/Middleware/AuthenticateOAuth.php index bd3c75a4..34ea5a8e 100644 --- a/app/Http/Middleware/AuthenticateOAuth.php +++ b/app/Http/Middleware/AuthenticateOAuth.php @@ -24,7 +24,7 @@ use Auth; use Closure; use GuzzleHttp; use Poniverse; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\User; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class AuthenticateOAuth diff --git a/app/Jobs/DeleteGenre.php b/app/Jobs/DeleteGenre.php index 5a518f1b..7e342ba5 100644 --- a/app/Jobs/DeleteGenre.php +++ b/app/Jobs/DeleteGenre.php @@ -21,11 +21,11 @@ namespace Poniverse\Ponyfm\Jobs; use Auth; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Queue\ShouldQueue; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use SerializesModels; class DeleteGenre extends Job implements SelfHandling, ShouldQueue diff --git a/app/Jobs/EncodeTrackFile.php b/app/Jobs/EncodeTrackFile.php index a54b68e7..276802e8 100644 --- a/app/Jobs/EncodeTrackFile.php +++ b/app/Jobs/EncodeTrackFile.php @@ -33,8 +33,8 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Queue\ShouldQueue; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\TrackFile; use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; diff --git a/app/Library/PFMAuth.php b/app/Library/PFMAuth.php index d5e98417..af68f278 100644 --- a/app/Library/PFMAuth.php +++ b/app/Library/PFMAuth.php @@ -40,6 +40,6 @@ class PFMAuth extends EloquentUserProvider { function __construct() { - parent::__construct(new NullHasher(), 'Poniverse\Ponyfm\User'); + parent::__construct(new NullHasher(), 'Poniverse\Ponyfm\Models\User'); } } diff --git a/app/Album.php b/app/Models/Album.php similarity index 95% rename from app/Album.php rename to app/Models/Album.php index 5530ce61..45025d66 100644 --- a/app/Album.php +++ b/app/Models/Album.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Exception; use Helpers; @@ -62,27 +62,27 @@ class Album extends Model public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function users() { - return $this->hasMany('Poniverse\Ponyfm\ResourceUser'); + return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser'); } public function favourites() { - return $this->hasMany('Poniverse\Ponyfm\Favourite'); + return $this->hasMany('Poniverse\Ponyfm\Models\Favourite'); } public function cover() { - return $this->belongsTo('Poniverse\Ponyfm\Image'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Image'); } public function tracks() { - return $this->hasMany('Poniverse\Ponyfm\Track')->orderBy('track_number', 'asc'); + return $this->hasMany('Poniverse\Ponyfm\Models\Track')->orderBy('track_number', 'asc'); } public function trackFiles() { @@ -91,7 +91,7 @@ class Album extends Model public function comments() { - return $this->hasMany('Poniverse\Ponyfm\Comment')->orderBy('created_at', 'desc'); + return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc'); } public static function mapPublicAlbumShow(Album $album) diff --git a/app/Comment.php b/app/Models/Comment.php similarity index 86% rename from app/Comment.php rename to app/Models/Comment.php index b5f6699f..7e66b628 100644 --- a/app/Comment.php +++ b/app/Models/Comment.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; @@ -34,27 +34,27 @@ class Comment extends Model public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function track() { - return $this->belongsTo('Poniverse\Ponyfm\Track'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Track'); } public function album() { - return $this->belongsTo('Poniverse\Ponyfm\Album'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Album'); } public function playlist() { - return $this->belongsTo('Poniverse\Ponyfm\Playlist'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist'); } public function profile() { - return $this->belongsTo('Poniverse\Ponyfm\User', 'profile_id'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User', 'profile_id'); } public static function mapPublic($comment) diff --git a/app/Favourite.php b/app/Models/Favourite.php similarity index 86% rename from app/Favourite.php rename to app/Models/Favourite.php index e3f52f5e..a916786e 100644 --- a/app/Favourite.php +++ b/app/Models/Favourite.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; @@ -35,22 +35,22 @@ class Favourite extends Model public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function track() { - return $this->belongsTo('Poniverse\Ponyfm\Track'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Track'); } public function album() { - return $this->belongsTo('Poniverse\Ponyfm\Album'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Album'); } public function playlist() { - return $this->belongsTo('Poniverse\Ponyfm\Playlist'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist'); } /** diff --git a/app/Follower.php b/app/Models/Follower.php similarity index 96% rename from app/Follower.php rename to app/Models/Follower.php index 1c3b6d31..143b88b4 100644 --- a/app/Follower.php +++ b/app/Models/Follower.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/Genre.php b/app/Models/Genre.php similarity index 98% rename from app/Genre.php rename to app/Models/Genre.php index 529352b3..d6f87511 100644 --- a/app/Genre.php +++ b/app/Models/Genre.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use DB; use Illuminate\Database\Eloquent\Relations\Relation; diff --git a/app/Image.php b/app/Models/Image.php similarity index 99% rename from app/Image.php rename to app/Models/Image.php index cc0d4d1e..5784ba89 100644 --- a/app/Image.php +++ b/app/Models/Image.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use External; use Illuminate\Database\Eloquent\Model; diff --git a/app/License.php b/app/Models/License.php similarity index 96% rename from app/License.php rename to app/Models/License.php index f3c48c27..df9ea181 100644 --- a/app/License.php +++ b/app/Models/License.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/PinnedPlaylist.php b/app/Models/PinnedPlaylist.php similarity index 85% rename from app/PinnedPlaylist.php rename to app/Models/PinnedPlaylist.php index 84d7d0f3..0d55098d 100644 --- a/app/PinnedPlaylist.php +++ b/app/Models/PinnedPlaylist.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; @@ -28,11 +28,11 @@ class PinnedPlaylist extends Model public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function playlist() { - return $this->belongsTo('Poniverse\Ponyfm\Playlist'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist'); } } diff --git a/app/Playlist.php b/app/Models/Playlist.php similarity index 95% rename from app/Playlist.php rename to app/Models/Playlist.php index a859acc4..7266aeef 100644 --- a/app/Playlist.php +++ b/app/Models/Playlist.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Helpers; use Illuminate\Database\Eloquent\Model; @@ -152,7 +152,7 @@ class Playlist extends Model public function tracks() { return $this - ->belongsToMany('Poniverse\Ponyfm\Track') + ->belongsToMany('Poniverse\Ponyfm\Models\Track') ->withPivot('position') ->withTimestamps() ->orderBy('position', 'asc'); @@ -166,22 +166,22 @@ class Playlist extends Model public function users() { - return $this->hasMany('Poniverse\Ponyfm\ResourceUser'); + return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser'); } public function comments() { - return $this->hasMany('Poniverse\Ponyfm\Comment')->orderBy('created_at', 'desc'); + return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc'); } public function pins() { - return $this->hasMany('Poniverse\Ponyfm\PinnedPlaylist'); + return $this->hasMany('Poniverse\Ponyfm\Models\PinnedPlaylist'); } public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function hasPinFor($userId) diff --git a/app/ResourceLogItem.php b/app/Models/ResourceLogItem.php similarity index 99% rename from app/ResourceLogItem.php rename to app/Models/ResourceLogItem.php index 39dc985c..42c29638 100644 --- a/app/ResourceLogItem.php +++ b/app/Models/ResourceLogItem.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; use Carbon\Carbon; diff --git a/app/ResourceUser.php b/app/Models/ResourceUser.php similarity index 97% rename from app/ResourceUser.php rename to app/Models/ResourceUser.php index e4b7b833..11386ac2 100644 --- a/app/ResourceUser.php +++ b/app/Models/ResourceUser.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/Role.php b/app/Models/Role.php similarity index 96% rename from app/Role.php rename to app/Models/Role.php index 35215138..66e2ca19 100644 --- a/app/Role.php +++ b/app/Models/Role.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/ShowSong.php b/app/Models/ShowSong.php similarity index 96% rename from app/ShowSong.php rename to app/Models/ShowSong.php index 4d6b71c4..92213cf3 100644 --- a/app/ShowSong.php +++ b/app/Models/ShowSong.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/Track.php b/app/Models/Track.php similarity index 97% rename from app/Track.php rename to app/Models/Track.php index c84f68ce..73f0cdc1 100644 --- a/app/Track.php +++ b/app/Models/Track.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Auth; use Cache; @@ -411,52 +411,52 @@ class Track extends Model public function genre() { - return $this->belongsTo('Poniverse\Ponyfm\Genre'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Genre'); } public function trackType() { - return $this->belongsTo('Poniverse\Ponyfm\TrackType', 'track_type_id'); + return $this->belongsTo('Poniverse\Ponyfm\Models\TrackType', 'track_type_id'); } public function comments() { - return $this->hasMany('Poniverse\Ponyfm\Comment')->orderBy('created_at', 'desc'); + return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc'); } public function favourites() { - return $this->hasMany('Poniverse\Ponyfm\Favourite'); + return $this->hasMany('Poniverse\Ponyfm\Models\Favourite'); } public function cover() { - return $this->belongsTo('Poniverse\Ponyfm\Image'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Image'); } public function showSongs() { - return $this->belongsToMany('Poniverse\Ponyfm\ShowSong'); + return $this->belongsToMany('Poniverse\Ponyfm\Models\ShowSong'); } public function users() { - return $this->hasMany('Poniverse\Ponyfm\ResourceUser'); + return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser'); } public function user() { - return $this->belongsTo('Poniverse\Ponyfm\User'); + return $this->belongsTo('Poniverse\Ponyfm\Models\User'); } public function album() { - return $this->belongsTo('Poniverse\Ponyfm\Album'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Album'); } public function trackFiles() { - return $this->hasMany('Poniverse\Ponyfm\TrackFile'); + return $this->hasMany('Poniverse\Ponyfm\Models\TrackFile'); } public function getYearAttribute() diff --git a/app/TrackFile.php b/app/Models/TrackFile.php similarity index 97% rename from app/TrackFile.php rename to app/Models/TrackFile.php index a705c998..b5089c44 100644 --- a/app/TrackFile.php +++ b/app/Models/TrackFile.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Config; use Helpers; @@ -36,7 +36,7 @@ class TrackFile extends Model public function track() { - return $this->belongsTo('Poniverse\Ponyfm\Track')->withTrashed(); + return $this->belongsTo('Poniverse\Ponyfm\Models\Track')->withTrashed(); } /** diff --git a/app/TrackType.php b/app/Models/TrackType.php similarity index 96% rename from app/TrackType.php rename to app/Models/TrackType.php index 23589e63..6973c49e 100644 --- a/app/TrackType.php +++ b/app/Models/TrackType.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Illuminate\Database\Eloquent\Model; diff --git a/app/User.php b/app/Models/User.php similarity index 93% rename from app/User.php rename to app/Models/User.php index 50d6f785..07ddec4e 100644 --- a/app/User.php +++ b/app/Models/User.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -namespace Poniverse\Ponyfm; +namespace Poniverse\Ponyfm\Models; use Gravatar; use Illuminate\Auth\Authenticatable; @@ -91,12 +91,12 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon public function avatar() { - return $this->belongsTo('Poniverse\Ponyfm\Image'); + return $this->belongsTo('Poniverse\Ponyfm\Models\Image'); } public function users() { - return $this->hasMany('Poniverse\Ponyfm\ResourceUser', 'artist_id'); + return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser', 'artist_id'); } public function roles() @@ -106,12 +106,12 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon public function comments() { - return $this->hasMany('Poniverse\Ponyfm\Comment', 'profile_id')->orderBy('created_at', 'desc'); + return $this->hasMany('Poniverse\Ponyfm\Models\Comment', 'profile_id')->orderBy('created_at', 'desc'); } public function tracks() { - return $this->hasMany('Poniverse\Ponyfm\Track', 'user_id'); + return $this->hasMany('Poniverse\Ponyfm\Models\Track', 'user_id'); } public function getIsArchivedAttribute() diff --git a/app/Policies/GenrePolicy.php b/app/Policies/GenrePolicy.php index 54e07780..711149a6 100644 --- a/app/Policies/GenrePolicy.php +++ b/app/Policies/GenrePolicy.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Policies; -use Poniverse\Ponyfm\Genre; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Genre; +use Poniverse\Ponyfm\Models\User; class GenrePolicy { diff --git a/app/Policies/TrackPolicy.php b/app/Policies/TrackPolicy.php index c137954a..7b788564 100644 --- a/app/Policies/TrackPolicy.php +++ b/app/Policies/TrackPolicy.php @@ -20,8 +20,8 @@ namespace Poniverse\Ponyfm\Policies; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; class TrackPolicy { diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 5367a7ad..820d57e3 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -22,11 +22,11 @@ namespace Poniverse\Ponyfm\Providers; use Illuminate\Contracts\Auth\Access\Gate as GateContract; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; -use Poniverse\Ponyfm\Genre; +use Poniverse\Ponyfm\Models\Genre; use Poniverse\Ponyfm\Policies\GenrePolicy; use Poniverse\Ponyfm\Policies\TrackPolicy; -use Poniverse\Ponyfm\Track; -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\Track; +use Poniverse\Ponyfm\Models\User; class AuthServiceProvider extends ServiceProvider { diff --git a/app/Traits/TrackCollection.php b/app/Traits/TrackCollection.php index ec8f15c9..442649bf 100644 --- a/app/Traits/TrackCollection.php +++ b/app/Traits/TrackCollection.php @@ -26,7 +26,7 @@ use File; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Relations\Relation; use Poniverse\Ponyfm\Jobs\EncodeTrackFile; -use Poniverse\Ponyfm\TrackFile; +use Poniverse\Ponyfm\Models\TrackFile; /** diff --git a/config/auth.php b/config/auth.php index c9bf4000..4aa4ab65 100644 --- a/config/auth.php +++ b/config/auth.php @@ -28,7 +28,7 @@ return [ | */ - 'model' => Poniverse\Ponyfm\User::class, + 'model' => Poniverse\Ponyfm\Models\User::class, /* |-------------------------------------------------------------------------- diff --git a/config/services.php b/config/services.php index 4f128fbf..f8e89649 100644 --- a/config/services.php +++ b/config/services.php @@ -30,7 +30,7 @@ return [ ], 'stripe' => [ - 'model' => Poniverse\Ponyfm\User::class, + 'model' => Poniverse\Ponyfm\Models\User::class, 'key' => '', 'secret' => '', ], diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index b49765a0..6be92289 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -29,9 +29,9 @@ | */ -use Poniverse\Ponyfm\User; +use Poniverse\Ponyfm\Models\User; -$factory->define(Poniverse\Ponyfm\User::class, function (\Faker\Generator $faker) { +$factory->define(Poniverse\Ponyfm\Models\User::class, function (\Faker\Generator $faker) { return [ 'username' => $faker->userName, 'display_name' => $faker->userName, @@ -45,14 +45,14 @@ $factory->define(Poniverse\Ponyfm\User::class, function (\Faker\Generator $faker ]; }); -$factory->define(\Poniverse\Ponyfm\Track::class, function(\Faker\Generator $faker) { +$factory->define(\Poniverse\Ponyfm\Models\Track::class, function(\Faker\Generator $faker) { $user = factory(User::class)->create(); return [ 'user_id' => $user->id, 'hash' => $faker->md5, 'title' => $faker->sentence(5), - 'track_type_id' => \Poniverse\Ponyfm\TrackType::UNCLASSIFIED_TRACK, + 'track_type_id' => \Poniverse\Ponyfm\Models\TrackType::UNCLASSIFIED_TRACK, 'genre' => $faker->word, 'album' => $faker->sentence(5), 'track_number' => null, diff --git a/database/migrations/2013_09_23_031316_create_track_hashes.php b/database/migrations/2013_09_23_031316_create_track_hashes.php index d80a4ff2..13c87c28 100644 --- a/database/migrations/2013_09_23_031316_create_track_hashes.php +++ b/database/migrations/2013_09_23_031316_create_track_hashes.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Database\Migrations\Migration; class CreateTrackHashes extends Migration diff --git a/database/migrations/2014_05_28_071738_update_track_hash.php b/database/migrations/2014_05_28_071738_update_track_hash.php index 43c8fc0e..fd207ad1 100644 --- a/database/migrations/2014_05_28_071738_update_track_hash.php +++ b/database/migrations/2014_05_28_071738_update_track_hash.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Database\Migrations\Migration; class UpdateTrackHash extends Migration diff --git a/database/migrations/2015_05_25_011121_create_track_files_table.php b/database/migrations/2015_05_25_011121_create_track_files_table.php index 301d2e52..8f94cfc2 100644 --- a/database/migrations/2015_05_25_011121_create_track_files_table.php +++ b/database/migrations/2015_05_25_011121_create_track_files_table.php @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; use Illuminate\Database\Migrations\Migration; diff --git a/database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php b/database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php index 0763ef03..8c98055a 100644 --- a/database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php +++ b/database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php @@ -20,7 +20,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -use Poniverse\Ponyfm\Track; +use Poniverse\Ponyfm\Models\Track; class AddTrackFilesForDeletedTracks extends Migration { diff --git a/database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php b/database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php new file mode 100644 index 00000000..eb47fa66 --- /dev/null +++ b/database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php @@ -0,0 +1,47 @@ +. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class UpdateModelNamespacesInRevisions extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + DB::table('revisions') + ->update(['revisionable_type' => DB::raw("replace(revisionable_type, 'Poniverse\\\\Ponyfm', 'Poniverse\\\\Ponyfm\\\\Models')")]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + DB::table('revisions') + ->update(['revisionable_type' => DB::raw("replace(revisionable_type, 'Poniverse\\\\Ponyfm\\\\Models', 'Poniverse\\\\Ponyfm')")]); + } +} diff --git a/resources/views/shared/_app_layout.blade.php b/resources/views/shared/_app_layout.blade.php index 6c811a19..06175a75 100644 --- a/resources/views/shared/_app_layout.blade.php +++ b/resources/views/shared/_app_layout.blade.php @@ -49,7 +49,7 @@ @if (Auth::check())