Moved all database models into their own namespace.

This commit is contained in:
Peter Deltchev 2015-12-31 16:12:30 -08:00
parent 79a0129e6d
commit 5ff04ff08d
84 changed files with 242 additions and 195 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -20,7 +20,7 @@
namespace Poniverse\Ponyfm\Commands;
use Poniverse\Ponyfm\Track;
use Poniverse\Ponyfm\Models\Track;
class DeleteTrackCommand extends CommandBase
{

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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
{

View file

@ -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

View file

@ -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;

View file

@ -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
{

View file

@ -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;

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{

View file

@ -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

View file

@ -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
{

View file

@ -20,7 +20,7 @@
namespace Poniverse\Ponyfm\Console\Commands;
use Poniverse\Ponyfm\ResourceLogItem;
use Poniverse\Ponyfm\Models\ResourceLogItem;
use DB;
use Illuminate\Console\Command;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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
{

View file

@ -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

View file

@ -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;

View file

@ -21,7 +21,7 @@
namespace Poniverse\Ponyfm\Http\Controllers;
use App;
use Poniverse\Ponyfm\User;
use Poniverse\Ponyfm\Models\User;
use View;
use Redirect;

View file

@ -20,7 +20,7 @@
namespace Poniverse\Ponyfm\Http\Controllers;
use Poniverse\Ponyfm\User;
use Poniverse\Ponyfm\Models\User;
use Auth;
use Config;
use DB;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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');
}
}

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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)

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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)

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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');
}
/**

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use DB;
use Illuminate\Database\Eloquent\Relations\Relation;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use External;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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');
}
}

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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)

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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()

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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();
}
/**

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm;
namespace Poniverse\Ponyfm\Models;
use Illuminate\Database\Eloquent\Model;

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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()

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{

View file

@ -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;
/**

View file

@ -28,7 +28,7 @@ return [
|
*/
'model' => Poniverse\Ponyfm\User::class,
'model' => Poniverse\Ponyfm\Models\User::class,
/*
|--------------------------------------------------------------------------

View file

@ -30,7 +30,7 @@ return [
],
'stripe' => [
'model' => Poniverse\Ponyfm\User::class,
'model' => Poniverse\Ponyfm\Models\User::class,
'key' => '',
'secret' => '',
],

View file

@ -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,

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Poniverse\Ponyfm\Track;
use Poniverse\Ponyfm\Models\Track;
use Illuminate\Database\Migrations\Migration;
class CreateTrackHashes extends Migration

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Poniverse\Ponyfm\Track;
use Poniverse\Ponyfm\Models\Track;
use Illuminate\Database\Migrations\Migration;
class UpdateTrackHash extends Migration

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Poniverse\Ponyfm\Track;
use Poniverse\Ponyfm\Models\Track;
use Illuminate\Database\Migrations\Migration;

View file

@ -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
{

View file

@ -0,0 +1,47 @@
<?php
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015 Peter Deltchev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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')")]);
}
}

View file

@ -49,7 +49,7 @@
@if (Auth::check())
<div class="user-details dropdown">
<a class="avatar dropdown-toggle" href="#">
<img src="{{Auth::user()->getAvatarUrl(\Poniverse\Ponyfm\Image::THUMBNAIL)}}" />
<img src="{{Auth::user()->getAvatarUrl(\Poniverse\Ponyfm\Models\Image::THUMBNAIL)}}" />
<span><i class="icon-chevron-down"></i></span>
</a>
<ul class="dropdown-menu">

View file

@ -42,7 +42,7 @@
<div class="player loading {{Auth::check() ? 'can-favourite' : ''}} {{$user['is_favourited'] ? 'favourited' : ''}}" data-track-id="{{ $track->id }}" data-duration="{{ $track->duration * 1000 }}">
<div class="play" disabled="disabled">
<div class="button"><i class="icon-play"></i></div>
<img src="{{ $track->getCoverUrl(\Poniverse\Ponyfm\Image::SMALL) }}" />
<img src="{{ $track->getCoverUrl(\Poniverse\Ponyfm\Models\Image::SMALL) }}" />
</div>
<div class="meta">
@if (Auth::check())

View file

@ -21,7 +21,7 @@
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Poniverse\Ponyfm\User;
use Poniverse\Ponyfm\Models\User;
class ApiAuthTest extends TestCase {
use DatabaseMigrations;

View file

@ -20,8 +20,8 @@
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Poniverse\Ponyfm\Track;
use Poniverse\Ponyfm\User;
use Poniverse\Ponyfm\Models\Track;
use Poniverse\Ponyfm\Models\User;
class ApiTest extends TestCase {
use DatabaseMigrations;

View file

@ -1,5 +1,5 @@
<?php
use Poniverse\Ponyfm\User;
use Poniverse\Ponyfm\Models\User;
/**
* Pony.fm - A community for pony fan music.