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,11 +1,13 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration {
public function up() {
Schema::create('users', function(Blueprint $table) {
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('display_name', 255);
$table->string('mlpforums_name')->nullable();
@ -21,12 +23,12 @@ class CreateUsersTable extends Migration {
$table->timestamps();
});
Schema::create('roles', function($table){
Schema::create('roles', function ($table) {
$table->increments('id');
$table->string('name');
});
Schema::create('role_user', function($table){
Schema::create('role_user', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('role_id')->unsigned()->index();
@ -36,7 +38,7 @@ class CreateUsersTable extends Migration {
$table->foreign('role_id')->references('id')->on('roles');
});
Schema::create('cache', function($table){
Schema::create('cache', function ($table) {
$table->string('key')->index();
$table->text('value');
$table->integer('expiration')->unsigned()->index();
@ -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,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreateTracksTable extends Migration {
public function up() {
Schema::create('licenses', function($table){
class CreateTracksTable extends Migration
{
public function up()
{
Schema::create('licenses', function ($table) {
$table->increments('id');
$table->string('title', 100);
$table->text('description');
@ -13,25 +15,25 @@ class CreateTracksTable extends Migration {
$table->boolean('remix');
});
Schema::create('genres', function($table){
Schema::create('genres', function ($table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('slug', 200)->index();
});
Schema::create('track_types', function($table){
Schema::create('track_types', function ($table) {
$table->increments('id');
$table->string('title');
$table->string('editor_title');
});
Schema::create('tracks', function($table){
Schema::create('tracks', function ($table) {
$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,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreateImagesTable extends Migration {
public function up() {
Schema::create('images', function($table) {
class CreateImagesTable extends Migration
{
public function up()
{
Schema::create('images', function ($table) {
$table->increments('id');
$table->string('filename', 256);
$table->string('mime', 100);
@ -17,24 +19,25 @@ class CreateImagesTable extends Migration {
$table->foreign('uploaded_by')->references('id')->on('users');
});
Schema::table('users', function($table) {
Schema::table('users', function ($table) {
$table->integer('avatar_id')->unsigned()->nullable();
$table->foreign('avatar_id')->references('id')->on('images');
});
DB::table('tracks')->update(['cover_id' => null]);
Schema::table('tracks', function($table) {
Schema::table('tracks', function ($table) {
$table->foreign('cover_id')->references('id')->on('images');
});
}
public function down() {
Schema::table('tracks', function($table) {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_cover_id_foreign');
});
Schema::table('users', function($table) {
Schema::table('users', function ($table) {
$table->dropForeign('users_avatar_id_foreign');
$table->dropColumn('avatar_id');
});

View file

@ -2,16 +2,18 @@
use Illuminate\Database\Migrations\Migration;
class CreateSongsTable extends Migration {
public function up() {
Schema::create('show_songs', function($table) {
class CreateSongsTable extends Migration
{
public function up()
{
Schema::create('show_songs', function ($table) {
$table->increments('id');
$table->string('title', 100);
$table->text('lyrics');
$table->string('slug', 200)->indexed();
});
Schema::create('show_song_track', function($table) {
Schema::create('show_song_track', function ($table) {
$table->increments('id');
$table->integer('track_id')->unsigned();
$table->integer('show_song_id')->unsigned();
@ -178,7 +180,7 @@ And tell that big dumb scary face to take a hike and leave you alone and if he t
Laaaaaaauuugh!",
'slug' => "laughter-song",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 4,
'title' => "Pinkie's Gala Fantasy Song",
'lyrics' => "[Pinkie Pie]
@ -198,8 +200,8 @@ Oh the Grand Galloping Gala is the best place for me
In the whole galaxy
Wheee!",
'slug' => "pinkies-gala-fantasy-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 5,
'title' => "The Ticket Song",
'lyrics' => "[Pinkie Pie]
@ -223,8 +225,8 @@ She'll give her extra ticket to the gala to me!
Twilight Sparkle: PIIINKIIIE!!",
'slug' => "the-ticket-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 6,
'title' => "Junior Speedsters Chant",
'lyrics' => "[Rainbow Dash/Gilda]
@ -233,8 +235,8 @@ Sky-bound soars and daring dives
Junior Speedsters, it's our quest,
To some day be the very best!",
'slug' => "junior-speedsters-chant",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 7,
'title' => "Hop Skip and Jump song",
'lyrics' => "[Pinkie Pie]
@ -253,8 +255,8 @@ A hop, skip and jump,
A hop skip and jump,
A hop skip and jump!",
'slug' => "hop-skip-and-jump-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 8,
'title' => "Evil Enchantress song",
'lyrics' => "[Pinkie Pie/Flutterguy]
@ -268,8 +270,8 @@ Then she'll gobble you up
In a big tasty stew
Soooo.... Watch out!",
'slug' => "evil-enchantress-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 9,
'title' => "Winter Wrap Up",
'lyrics' => "[Rainbow Dash]
@ -408,8 +410,8 @@ Winter Wrap Up! Winter Wrap Up!
'Cause tomorrow spring is here
'Cause tomorrow spring is here!",
'slug' => "winter-wrap-up",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 10,
'title' => "Cupcake Song",
'lyrics' => "[Pinkie Pie]
@ -427,8 +429,8 @@ Cupcakes! So sweet and tasty!
Cupcakes! Don't be too hasty!
Cupcakes! Cupcakes, cupcakes, CUPCAKES!",
'slug' => "cupcake-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 11,
'title' => "Art of the Dress",
'lyrics' => "[Rarity]
@ -468,8 +470,8 @@ Thread by thread, primmed and pressed
Yard by yard, never stressed
And that's the art of the dress!",
'slug' => "art-of-the-dress",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 12,
'title' => "Hush Now Lullaby",
'lyrics' => "[Fluttershy]
@ -503,8 +505,8 @@ It's time to go to BED!
OW!",
'slug' => "hush-now-lullaby",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 13,
'title' => "Cutie Mark Crusaders Song",
'lyrics' => "[Scootaloo]
@ -557,8 +559,8 @@ On a quest to find out who we are
And we will never stop the journey
Not until we have our cutie marks!",
'slug' => "cutie-mark-crusaders-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 14,
'title' => "You Got to Share, You Got to Care",
'lyrics' => "[Pinkie Pie]
@ -595,8 +597,8 @@ It's the right thing to do
And there'll always be a way
Thro-o-o-o-ugh!",
'slug' => "you-got-to-share-you-got-to-care",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 15,
'title' => "So Many Wonders",
'lyrics' => "[Fluttershy]
@ -619,8 +621,8 @@ I'd have come here sooner, and never leave
Yes, I love everythiiiiiiiiiiiing!",
'slug' => "so-many-wonders",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 16,
'title' => "Pinkie Pie's Singing Telegram",
'lyrics' => "[Pinkie Pie]
@ -649,8 +651,8 @@ So we hope that you say yes
So, please, oh please R.S.V.P
And come, and be our guest!",
'slug' => "pinkie-pies-singing-telegram",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 17,
'title' => "At the Gala",
'lyrics' => "Twilight Sparkle: I can't believe we're finally here. With all that we've imagined, the reality of this night is sure to make this... The Best Night Ever!
@ -764,8 +766,8 @@ Into the Gala, into the Gala!
And we'll have the best night ever!
At the Gala!",
'slug' => "at-the-gala",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 18,
'title' => "I'm at the Grand Galloping Gala",
'lyrics' => "[Pinkie Pie]
@ -781,8 +783,8 @@ I'm at the Grand Galloping GalaaaaaaaaaaAAAAAAAAAAAA!
It's all I ever... dreamed?",
'slug' => "im-at-the-grand-galloping-gala",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 19,
'title' => "Pony Pokey",
'lyrics' => "[Pinkie]
@ -831,8 +833,8 @@ And that's what it's all about
Yeah!",
'slug' => "pony-pokey",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 20,
'title' => "Find A Pet Song",
'lyrics' => "[Fluttershy]
@ -970,8 +972,8 @@ Begin
Rainbow Dash: And may the best pet win!",
'slug' => "find-a-pet-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 21,
'title' => "Becoming Popular (The Pony Everypony Should Know)",
'lyrics' => "[Rarity]
@ -999,8 +1001,8 @@ Because I'm the type of pony
Yes, I'm the type of pony
Yes, I'm the type of pony everypony should know",
'slug' => "becoming-popular-the-pony-everypony-should-know",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 22,
'title' => "The Heart Carol",
'lyrics' => "[Choir]
@ -1011,8 +1013,8 @@ Laughter and singing will see us through (will see us through)
We are a circle of pony friends
A circle of friends we'll be to the very end",
'slug' => "the-heart-carol",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 23,
'title' => "Happy Monthiversary",
'lyrics' => "[Pinkie Pie]
@ -1020,8 +1022,8 @@ Happy monthiversary to you and you today
[very quickly] I can't believe you're already a month old time sure flies doesn't it well it seems like only yesterday you were born.
But now you're a month old today, hey!",
'slug' => "happy-monthiversary",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 24,
'title' => "Piggy Dance",
'lyrics' => "[Pinkie Pie]
@ -1031,8 +1033,8 @@ Then you wiggle your rump! Oink oink oink!
Then shout it out! Oink oink oink!
[repeat verse two more times]",
'slug' => "piggy-dance",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 25,
'title' => "The Flim Flam Brothers",
'lyrics' => "[Flim]
@ -1196,8 +1198,8 @@ Traveling salesponies nonpareil
[Flim and Flam]
Yeah!",
'slug' => "the-flim-flam-brothers",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 26,
'title' => "The Perfect Stallion",
'lyrics' => "[Sweetie Belle]
@ -1279,8 +1281,8 @@ Who will send our teacher's heart aflutter.
Apple Bloom: Wait a minute. Let me get this straight. Are you talking about my brother?",
'slug' => "the-perfect-stallion",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 27,
'title' => "Smile Song",
'lyrics' => "[Pinkie Pie]
@ -1355,8 +1357,8 @@ Smile, smile, smile, smile, smile!
Come on and smile
Come on and smile!",
'slug' => "smile-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 28,
'title' => "Cranky Doodle Donkey",
'lyrics' => "[Pinkie Pie]
@ -1364,8 +1366,8 @@ You're a Cranky Doodle Donkey guy.
A Cranky Doodle Donkey.
I never met you but you're my new friend and I'm your best friend Pinkie Pie!",
'slug' => "cranky-doodle-donkey",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 29,
'title' => "Welcome Song",
'lyrics' => "[Pinkie Pie]
@ -1380,8 +1382,8 @@ To Ponyville today
Pinkie Pie: Wait for it!",
'slug' => "welcome-song",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 30,
'title' => "Cranky Doodle Joy",
'lyrics' => "[Pinkie Pie]
@ -1393,8 +1395,8 @@ I helped the Cranky Doodle boy!
Cranky Doodle Donkey and Matilda: Pinkie!
Pinkie Pie: Whoops, privacy. Sorry.",
'slug' => "cranky-doodle-joy",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 31,
'title' => "Big Brother Best Friend Forever (B.B.B.F.F.)",
'lyrics' => "[Twilight Sparkle]
@ -1425,8 +1427,8 @@ My big brother best friend
Forever...
Forever...",
'slug' => "big-brother-best-friend-forever-bbbff",
]);
DB::table('show_songs')->insert([
]);
DB::table('show_songs')->insert([
'id' => 32,
'title' => "This Day Aria",
'lyrics' => "[Queen Chrysalis]
@ -1477,7 +1479,7 @@ Shining Armor will be
[Queen Chrysalis]: ...mine, all mine. [evil laugh]",
'slug' => "this-day-aria",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 33,
'title' => "Love Is In Bloom",
'lyrics' => "[Twilight Sparkle]
@ -1504,7 +1506,7 @@ You're starting a life and making room
For us, (For us... For us...Aah...)",
'slug' => "love-is-in-bloom",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 34,
'title' => "The Failure Song",
'lyrics' => "[Twilight Sparkle]
@ -1556,7 +1558,7 @@ No I wasn't
Prepared... for this!",
'slug' => "the-failure-song",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 35,
'title' => "The Ballad of the Crystal Empire",
'lyrics' => "[Twilight Sparkle]
@ -1599,7 +1601,7 @@ Yes we have to make them see
We can save the Crystal Ponies... with their history!",
'slug' => "the-ballad-of-the-crystal-empire",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 36,
'title' => "The Success Song",
'lyrics' => "[Rarity]
@ -1646,7 +1648,7 @@ Turns out you were
Prepared... for this!",
'slug' => "the-success-song",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 37,
'title' => "Babs Seed",
'lyrics' => "[Cutie Mark Crusaders]
@ -1710,7 +1712,7 @@ Babs Seed, Babs Seed-
She's just a bad, bad seed",
'slug' => "babs-seed",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 38,
'title' => "Raise This Barn",
'lyrics' => "[Applejack]
@ -1805,7 +1807,7 @@ Is part of the Apple family
Apple Bloom: Yeah!",
'slug' => "raise-this-barn",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 39,
'title' => "Morning in Ponyville",
'lyrics' => "[Twilight Sparkle]
@ -1830,7 +1832,7 @@ Morning in Ponyville shines
That everything is certainly...",
'slug' => "morning-in-ponyville",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 40,
'title' => "What My Cutie Mark Is Telling Me",
'lyrics' => "[Rainbow Dash]
@ -1882,7 +1884,7 @@ It's what my cutie mark
Yes, it's what my cutie mark is telling me!",
'slug' => "what-my-cutie-mark-is-telling-me",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 41,
'title' => "I've Got to Find a Way",
'lyrics' => "[Twilight Sparkle]
@ -1901,7 +1903,7 @@ I fear I won't get through to you
Oh why, oh why",
'slug' => "ive-got-to-find-a-way",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 42,
'title' => "A True, True Friend",
'lyrics' => "[Twilight Sparkle]
@ -1984,7 +1986,7 @@ That shines (that shines)
From a true, true friend!",
'slug' => "a-true-true-friend",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 43,
'title' => "Celestia's Ballad",
'lyrics' => "[Princess Celestia]
@ -2003,7 +2005,7 @@ To find what you will be
For it's time for you to fulfill your destiny",
'slug' => "celestias-ballad",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 44,
'title' => "Behold, Princess Twilight Sparkle",
'lyrics' => "[Choir]
@ -2019,7 +2021,7 @@ The Princess is
The Princess is here",
'slug' => "behold-princess-twilight-sparkle",
]);
DB::table('show_songs')->insert([
DB::table('show_songs')->insert([
'id' => 45,
'title' => "Life in Equestria",
'lyrics' => "[Twilight Sparkle]
@ -2038,8 +2040,9 @@ Twilight Sparkle: Yes! Everything’s going to be just fine!",
]);
}
public function down() {
Schema::table('show_song_track', function($table){
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,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreateAlbums extends Migration {
public function up() {
Schema::create('albums', function($table) {
class CreateAlbums extends Migration
{
public function up()
{
Schema::create('albums', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('title')->index();
@ -25,7 +27,7 @@ class CreateAlbums extends Migration {
$table->foreign('user_id')->references('id')->on('users');
});
Schema::table('tracks', function($table) {
Schema::table('tracks', function ($table) {
$table->integer('album_id')->unsigned()->nullable();
$table->integer('track_number')->unsigned()->nullable();
@ -33,8 +35,9 @@ class CreateAlbums extends Migration {
});
}
public function down() {
Schema::table('tracks', function($table) {
public function down()
{
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_album_id_foreign');
$table->dropColumn('album_id');
$table->dropColumn('track_number');

View file

@ -2,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreatePlaylists extends Migration {
public function up() {
Schema::create('playlists', function($table) {
class CreatePlaylists extends Migration
{
public function up()
{
Schema::create('playlists', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->string('title');
@ -25,7 +27,7 @@ class CreatePlaylists extends Migration {
$table->foreign('user_id')->references('id')->on('users')->on_update('cascade');
});
Schema::create('playlist_track', function($table){
Schema::create('playlist_track', function ($table) {
$table->increments('id');
$table->timestamps();
$table->integer('playlist_id')->unsigned()->index();
@ -36,7 +38,7 @@ class CreatePlaylists extends Migration {
$table->foreign('track_id')->references('id')->on('tracks')->on_update('cascade');
});
Schema::create('pinned_playlists', function($table) {
Schema::create('pinned_playlists', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('playlist_id')->unsigned()->index();
@ -47,8 +49,9 @@ class CreatePlaylists extends Migration {
});
}
public function down() {
Schema::table('playlist_track', function($table){
public function down()
{
Schema::table('playlist_track', function ($table) {
$table->dropForeign('playlist_track_playlist_id_foreign');
$table->dropForeign('playlist_track_track_id_foreign');
});
@ -57,7 +60,7 @@ class CreatePlaylists extends Migration {
Schema::drop('pinned_playlists');
Schema::table('playlists', function($table){
Schema::table('playlists', function ($table) {
$table->dropForeign('playlists_user_id_foreign');
});

View file

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

View file

@ -2,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreateUserTables extends Migration {
public function up() {
Schema::create('resource_users', function($table){
class CreateUserTables extends Migration
{
public function up()
{
Schema::create('resource_users', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -30,7 +32,7 @@ class CreateUserTables extends Migration {
$table->unique(['user_id', 'track_id', 'album_id', 'playlist_id', 'artist_id'], 'resource_unique');
});
Schema::create('resource_log_items', function($table){
Schema::create('resource_log_items', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable()->index();
$table->integer('log_type')->unsigned();
@ -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

@ -1,10 +1,12 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Migrations\Migration;
class CreateFavourites extends Migration {
public function up() {
Schema::create('favourites', function($table){
class CreateFavourites extends Migration
{
public function up()
{
Schema::create('favourites', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
@ -21,8 +23,9 @@
});
}
public function down() {
Schema::table('favourites', function($table){
public function down()
{
Schema::table('favourites', function ($table) {
$table->dropForeign('favourites_user_id_foreign');
$table->dropForeign('favourites_track_id_foreign');
$table->dropForeign('favourites_album_id_foreign');
@ -31,4 +34,4 @@
Schema::drop('favourites');
}
}
}

View file

@ -2,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class CreateFollowers extends Migration {
public function up() {
Schema::create('followers', function($table){
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,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class Oauth extends Migration {
public function up() {
Schema::create('oauth2_tokens', function($table) {
class Oauth extends Migration
{
public function up()
{
Schema::create('oauth2_tokens', function ($table) {
$table->increments('id');
$table->integer('user_id');
$table->integer('external_user_id');
@ -16,7 +18,8 @@ class Oauth extends Migration {
});
}
public function down() {
public function down()
{
Schema::drop('oauth2_tokens');
}
}

View file

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

View file

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

View file

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

View file

@ -2,9 +2,11 @@
use Illuminate\Database\Migrations\Migration;
class TrackIsListed extends Migration {
public function up() {
Schema::table('tracks', function($table) {
class TrackIsListed extends Migration
{
public function up()
{
Schema::table('tracks', function ($table) {
$table->boolean('is_listed')->notNullable()->indexed();
});
@ -15,8 +17,9 @@ class TrackIsListed extends Migration {
is_listed = true');
}
public function down() {
Schema::table('tracks', function($table) {
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,15 +2,18 @@
use Illuminate\Database\Migrations\Migration;
class AddRememberMeField extends Migration {
public function up() {
Schema::table('users', function($table) {
class AddRememberMeField extends Migration
{
public function up()
{
Schema::table('users', function ($table) {
$table->string('remember_token', 100)->nullable()->indexed();
});
}
public function down() {
Schema::table('users', function($table) {
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.
@ -11,9 +12,9 @@ class AddArchivedProfileField extends Migration {
*/
public function up()
{
Schema::table('users', function ( $table ) {
$table->boolean( 'is_archived' )->default(false);
} );
Schema::table('users', function ($table) {
$table->boolean('is_archived')->default(false);
});
}
/**
@ -23,9 +24,9 @@ class AddArchivedProfileField extends Migration {
*/
public function down()
{
Schema::table( 'users', function ( $table ) {
$table->dropColumn( 'is_archived' );
} );
Schema::table('users', function ($table) {
$table->dropColumn('is_archived');
});
}
}

View file

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