Update namespace to App

This commit is contained in:
Kelvin Zhang 2015-08-31 13:35:47 +01:00
parent 14125fb5c6
commit 39290f8204
37 changed files with 921 additions and 821 deletions

View file

@ -1,5 +1,8 @@
<?php
namespace App;
use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
@ -36,32 +39,32 @@ class Album extends Model
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function users()
{
return $this->hasMany('ResourceUser');
return $this->hasMany('App\ResourceUser');
}
public function favourites()
{
return $this->hasMany('Favourite');
return $this->hasMany('App\Favourite');
}
public function cover()
{
return $this->belongsTo('Image');
return $this->belongsTo('App\Image');
}
public function tracks()
{
return $this->hasMany('Track')->orderBy('track_number', 'asc');
return $this->hasMany('App\Track')->orderBy('track_number', 'asc');
}
public function comments()
{
return $this->hasMany('Comment')->orderBy('created_at', 'desc');
return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
}
public static function mapPublicAlbumShow($album)

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@ -14,27 +16,27 @@ class Comment extends Model
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function track()
{
return $this->belongsTo('Track');
return $this->belongsTo('App\Track');
}
public function album()
{
return $this->belongsTo('Album');
return $this->belongsTo('App\Album');
}
public function playlist()
{
return $this->belongsTo('Playlist');
return $this->belongsTo('App\Playlist');
}
public function profile()
{
return $this->belongsTo('User', 'profile_id');
return $this->belongsTo('App\User', 'profile_id');
}
public static function mapPublic($comment)

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Favourite extends Model
@ -15,22 +17,22 @@ class Favourite extends Model
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function track()
{
return $this->belongsTo('Track');
return $this->belongsTo('App\Track');
}
public function album()
{
return $this->belongsTo('Album');
return $this->belongsTo('App\Album');
}
public function playlist()
{
return $this->belongsTo('Playlist');
return $this->belongsTo('App\Playlist');
}
/**

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Follower extends Model

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Traits\SlugTrait;

View file

@ -1,5 +1,8 @@
<?php
namespace App;
use External;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class License extends Model

View file

@ -1,7 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use SimplePie;
class News extends Model
{

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class PinnedPlaylist extends Model
@ -8,11 +10,11 @@ class PinnedPlaylist extends Model
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function playlist()
{
return $this->belongsTo('Playlist');
return $this->belongsTo('App\Playlist');
}
}

View file

@ -1,5 +1,8 @@
<?php
namespace App;
use Helpers;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
@ -124,7 +127,7 @@ class Playlist extends Model
public function tracks()
{
return $this
->belongsToMany('Track')
->belongsToMany('App\Track')
->withPivot('position')
->withTimestamps()
->orderBy('position', 'asc');
@ -132,22 +135,22 @@ class Playlist extends Model
public function users()
{
return $this->hasMany('ResourceUser');
return $this->hasMany('App\ResourceUser');
}
public function comments()
{
return $this->hasMany('Comment')->orderBy('created_at', 'desc');
return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
}
public function pins()
{
return $this->hasMany('PinnedPlaylist');
return $this->hasMany('App\PinnedPlaylist');
}
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function hasPinFor($userId)

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Support\Facades\DB;
class ProfileRequest

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ResourceUser extends Model

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ShowSong extends Model

View file

@ -1,5 +1,11 @@
<?php
namespace App;
use Exception;
use External;
use getid3_writetags;
use Helpers;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth;
@ -321,52 +327,52 @@ class Track extends Model
public function genre()
{
return $this->belongsTo('Genre');
return $this->belongsTo('App\Genre');
}
public function trackType()
{
return $this->belongsTo('TrackType', 'track_type_id');
return $this->belongsTo('App\TrackType', 'track_type_id');
}
public function comments()
{
return $this->hasMany('Comment')->orderBy('created_at', 'desc');
return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
}
public function favourites()
{
return $this->hasMany('Favourite');
return $this->hasMany('App\Favourite');
}
public function cover()
{
return $this->belongsTo('Image');
return $this->belongsTo('App\Image');
}
public function showSongs()
{
return $this->belongsToMany('ShowSong');
return $this->belongsToMany('App\ShowSong');
}
public function users()
{
return $this->hasMany('ResourceUser');
return $this->hasMany('App\ResourceUser');
}
public function user()
{
return $this->belongsTo('User');
return $this->belongsTo('App\User');
}
public function album()
{
return $this->belongsTo('Album');
return $this->belongsTo('App\Album');
}
public function trackFiles()
{
return $this->hasMany('TrackFile');
return $this->hasMany('App\TrackFile');
}
public function getYear()

View file

@ -1,5 +1,8 @@
<?php
namespace App;
use Helpers;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache;
@ -9,7 +12,7 @@ class TrackFile extends Model
{
public function track()
{
return $this->belongsTo('Track');
return $this->belongsTo('App\Track');
}
/**

View file

@ -1,5 +1,7 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class TrackType extends Model

View file

@ -1,5 +1,9 @@
<?php
namespace App;
use Exception;
use Gravatar;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
@ -31,17 +35,17 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
public function avatar()
{
return $this->belongsTo('Image');
return $this->belongsTo('App\Image');
}
public function users()
{
return $this->hasMany('ResourceUser', 'artist_id');
return $this->hasMany('App\ResourceUser', 'artist_id');
}
public function comments()
{
return $this->hasMany('Comment', 'profile_id')->orderBy('created_at', 'desc');
return $this->hasMany('App\Comment', 'profile_id')->orderBy('created_at', 'desc');
}
public function getIsArchivedAttribute()

View file

@ -1,10 +1,12 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration {
public function up() {
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('display_name', 255);
@ -48,7 +50,8 @@ class CreateUsersTable extends Migration {
DB::table('roles')->insert(['name' => 'user']);
}
public function down() {
public function down()
{
Schema::drop('cache');
Schema::drop('role_user');
Schema::drop('roles');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateTracksTable extends Migration {
public function up() {
class CreateTracksTable extends Migration
{
public function up()
{
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('title', 100);
@ -29,9 +31,9 @@ class CreateTracksTable extends Migration {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('license_id')->unsigned()->nullable()->default(NULL);
$table->integer('genre_id')->unsigned()->nullable()->index()->default(NULL);
$table->integer('track_type_id')->unsigned()->nullable()->default(NULL);
$table->integer('license_id')->unsigned()->nullable()->default(null);
$table->integer('genre_id')->unsigned()->nullable()->index()->default(null);
$table->integer('track_type_id')->unsigned()->nullable()->default(null);
$table->string('title', 100)->index();
$table->string('slug', 200)->index();
@ -119,7 +121,8 @@ class CreateTracksTable extends Migration {
]);
}
public function down() {
public function down()
{
Schema::drop('tracks');
Schema::drop('licenses');
Schema::drop('track_types');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateImagesTable extends Migration {
public function up() {
class CreateImagesTable extends Migration
{
public function up()
{
Schema::create('images', function ($table) {
$table->increments('id');
$table->string('filename', 256);
@ -29,7 +31,8 @@ class CreateImagesTable extends Migration {
});
}
public function down() {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_cover_id_foreign');
});

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateSongsTable extends Migration {
public function up() {
class CreateSongsTable extends Migration
{
public function up()
{
Schema::create('show_songs', function ($table) {
$table->increments('id');
$table->string('title', 100);
@ -2038,7 +2040,8 @@ Twilight Sparkle: Yes! Everything’s going to be just fine!",
]);
}
public function down() {
public function down()
{
Schema::table('show_song_track', function ($table) {
$table->dropForeign('show_song_track_track_id_foreign');
$table->dropForeign('show_song_track_show_song_id_foreign');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateAlbums extends Migration {
public function up() {
class CreateAlbums extends Migration
{
public function up()
{
Schema::create('albums', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
@ -33,7 +35,8 @@ class CreateAlbums extends Migration {
});
}
public function down() {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_album_id_foreign');
$table->dropColumn('album_id');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreatePlaylists extends Migration {
public function up() {
class CreatePlaylists extends Migration
{
public function up()
{
Schema::create('playlists', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -47,7 +49,8 @@ class CreatePlaylists extends Migration {
});
}
public function down() {
public function down()
{
Schema::table('playlist_track', function ($table) {
$table->dropForeign('playlist_track_playlist_id_foreign');
$table->dropForeign('playlist_track_track_id_foreign');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateComments extends Migration {
public function up() {
class CreateComments extends Migration
{
public function up()
{
Schema::create('comments', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
@ -26,7 +28,8 @@ class CreateComments extends Migration {
});
}
public function down() {
public function down()
{
Schema::table('comments', function ($table) {
$table->dropForeign('comments_user_id_foreign');
$table->dropForeign('comments_track_id_foreign');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateUserTables extends Migration {
public function up() {
class CreateUserTables extends Migration
{
public function up()
{
Schema::create('resource_users', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -50,7 +52,8 @@ class CreateUserTables extends Migration {
});
}
public function down() {
public function down()
{
Schema::drop('resource_users');
Schema::drop('resource_log_items');
}

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateFavourites extends Migration {
public function up() {
class CreateFavourites extends Migration
{
public function up()
{
Schema::create('favourites', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -21,7 +23,8 @@
});
}
public function down() {
public function down()
{
Schema::table('favourites', function ($table) {
$table->dropForeign('favourites_user_id_foreign');
$table->dropForeign('favourites_track_id_foreign');

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateFollowers extends Migration {
public function up() {
class CreateFollowers extends Migration
{
public function up()
{
Schema::create('followers', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -19,7 +21,8 @@ class CreateFollowers extends Migration {
});
}
public function down() {
public function down()
{
Schema::drop('followers');
}
}

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class Oauth extends Migration {
public function up() {
class Oauth extends Migration
{
public function up()
{
Schema::create('oauth2_tokens', function ($table) {
$table->increments('id');
$table->integer('user_id');
@ -16,7 +18,8 @@ class Oauth extends Migration {
});
}
public function down() {
public function down()
{
Schema::drop('oauth2_tokens');
}
}

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateNewsTable extends Migration {
public function up() {
class CreateNewsTable extends Migration
{
public function up()
{
Schema::create('news', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -14,7 +16,8 @@ class CreateNewsTable extends Migration {
});
}
public function down() {
public function down()
{
Schema::drop('news');
}

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class CreateLatestColumn extends Migration {
public function up() {
class CreateLatestColumn extends Migration
{
public function up()
{
Schema::table('tracks', function ($table) {
$table->boolean('is_latest')->notNullable()->indexed();
});
@ -29,7 +31,8 @@ class CreateLatestColumn extends Migration {
published_at IS NOT NULL');
}
public function down() {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropColumn('is_latest');
});

View file

@ -1,10 +1,12 @@
<?php
use Entities\Track;
use App\Track;
use Illuminate\Database\Migrations\Migration;
class CreateTrackHashes extends Migration {
public function up() {
class CreateTrackHashes extends Migration
{
public function up()
{
Schema::table('tracks', function ($table) {
$table->string('hash', 32)->notNullable()->indexed();
});
@ -15,7 +17,8 @@ class CreateTrackHashes extends Migration {
}
}
public function down() {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropColumn('hash');
});

View file

@ -2,8 +2,10 @@
use Illuminate\Database\Migrations\Migration;
class TrackIsListed extends Migration {
public function up() {
class TrackIsListed extends Migration
{
public function up()
{
Schema::table('tracks', function ($table) {
$table->boolean('is_listed')->notNullable()->indexed();
});
@ -15,7 +17,8 @@ class TrackIsListed extends Migration {
is_listed = true');
}
public function down() {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropColumn('is_listed');
});

View file

@ -1,16 +1,19 @@
<?php
use App\Track;
use Illuminate\Database\Migrations\Migration;
use Entities\Track;
class UpdateTrackHash extends Migration {
public function up() {
class UpdateTrackHash extends Migration
{
public function up()
{
foreach (Track::with('user')->get() as $track) {
$track->updateHash();
$track->save();
}
}
public function down() {
public function down()
{
}
}

View file

@ -2,14 +2,17 @@
use Illuminate\Database\Migrations\Migration;
class AddRememberMeField extends Migration {
public function up() {
class AddRememberMeField extends Migration
{
public function up()
{
Schema::table('users', function ($table) {
$table->string('remember_token', 100)->nullable()->indexed();
});
}
public function down() {
public function down()
{
Schema::table('users', function ($table) {
$table->dropColumn('remember_token');
});

View file

@ -2,7 +2,8 @@
use Illuminate\Database\Migrations\Migration;
class AddArchivedProfileField extends Migration {
class AddArchivedProfileField extends Migration
{
/**
* Run the migrations.

View file

@ -1,5 +1,6 @@
<?php
use App\Track;
use Illuminate\Database\Migrations\Migration;