w0bm.com v1.5z FULL.RETARD.BUILD.BUT.STILL.WORKS
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite
|
21
database/factories/ModelFactory.php
Normal file
21
database/factories/ModelFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->email,
|
||||
'password' => bcrypt(str_random(10)),
|
||||
'remember_token' => str_random(10),
|
||||
];
|
||||
});
|
0
database/migrations/.gitkeep
Normal file
0
database/migrations/.gitkeep
Normal file
100
database/migrations/2015_03_20_193906_verify_init.php
Normal file
100
database/migrations/2015_03_20_193906_verify_init.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class VerifyInit extends Migration
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->prefix = Config::get('verify.prefix', '');
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$prefix = $this->prefix;
|
||||
|
||||
Schema::create($prefix . 'permissions', function($table)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->increments('id');
|
||||
$table->string('name', 100)->index();
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create($prefix . 'roles', function($table)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->increments('id');
|
||||
$table->string('name', 100)->index();
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->integer('level');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create($prefix . 'users', function($table)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->increments('id');
|
||||
$table->string('username', 30)->index();
|
||||
$table->string('password', 60)->index();
|
||||
$table->string('salt', 32);
|
||||
$table->string('email', 255)->index();
|
||||
$table->string('remember_token', 100)->nullable()->index();
|
||||
$table->boolean('verified')->default(0);
|
||||
$table->boolean('disabled')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create($prefix . 'role_user', function($table) use ($prefix)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->integer('user_id')->unsigned()->index();
|
||||
$table->integer('role_id')->unsigned()->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')
|
||||
->references('id')
|
||||
->on($prefix . 'users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('role_id')
|
||||
->references('id')
|
||||
->on($prefix . 'roles')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::create($prefix . 'permission_role', function($table) use ($prefix)
|
||||
{
|
||||
$table->engine = 'InnoDB';
|
||||
|
||||
$table->integer('permission_id')->unsigned()->index();
|
||||
$table->integer('role_id')->unsigned()->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('permission_id')
|
||||
->references('id')
|
||||
->on($prefix . 'permissions')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('role_id')
|
||||
->references('id')
|
||||
->on($prefix . 'roles')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::drop($this->prefix . 'role_user');
|
||||
Schema::drop($this->prefix . 'permission_role');
|
||||
Schema::drop($this->prefix . 'users');
|
||||
Schema::drop($this->prefix . 'roles');
|
||||
Schema::drop($this->prefix . 'permissions');
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateVideosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('videos', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('file')->unique();
|
||||
$table->string('interpret')->nullable();
|
||||
$table->string('songtitle')->nullable();
|
||||
$table->string('imgsource')->nullable();
|
||||
$table->unsignedInteger('category_id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('videos');
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categories', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('shortname')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('categories');
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCommentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('comments', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('content');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('video_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('comments');
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddHashToVideosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('videos', function(Blueprint $table) {
|
||||
$table->char('hash', 40)->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('videos', function(Blueprint $table) {
|
||||
$table->dropColumn('hash');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddActivationTokenToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->string('activation_token', 50)->nullable()->index()->after('remember_token');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->dropColumn('activation_token');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateModeratorLogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('moderator_logs', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->string('type');
|
||||
$table->string('target_type');
|
||||
$table->unsignedInteger('target_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('moderator_logs');
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBackgroundToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->boolean('background')->default(true)->after('email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->dropColumn('background');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUserVideoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('favorites', function(Blueprint $table) {
|
||||
$table->unsignedInteger('user_id')->index();
|
||||
$table->unsignedInteger('video_id')->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('video_id')->references('id')->on('videos')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('favorites');
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMessagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\Schema::create('messages', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('from')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
|
||||
$table->unsignedInteger('to')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
|
||||
$table->text('content');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
\Illuminate\Support\Facades\Schema::drop('messages');
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddReadFieldToMessagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('messages', function(Blueprint $table) {
|
||||
$table->timestamp('read')->nullable();
|
||||
$table->string('subject')->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('messages', function(Blueprint $table) {
|
||||
$table->dropColumn(['read', 'subject']);
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddsCategoriesFieldToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->json('categories')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('categories');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBanningToUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('banreason')->nullable();
|
||||
$table->timestamp('banend')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['banreason', 'banend']);
|
||||
});
|
||||
}
|
||||
}
|
55
database/migrations/2016_09_22_092717_add_icons.php
Normal file
55
database/migrations/2016_09_22_092717_add_icons.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIcons extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('icons', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('icon', 255);
|
||||
$table->string('icon_type', 255);
|
||||
});
|
||||
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->unsignedInteger('icon_id')->index()->nullable();
|
||||
$table->foreign('icon_id')
|
||||
->references('id')
|
||||
->on('icons')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('roles', function(Blueprint $table) {
|
||||
$table->unsignedInteger('icon_id')->index()->nullable();
|
||||
$table->foreign('icon_id')
|
||||
->references('id')
|
||||
->on('icons')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('icons');
|
||||
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->dropColumn('icon_id');
|
||||
});
|
||||
|
||||
Schema::table('roles', function(Blueprint $table) {
|
||||
$table->dropColumn('icon_id');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddReasonToModeratorLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('moderator_logs', function (Blueprint $table) {
|
||||
$table->string('reason')->nullable()->after('target_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('moderator_logs', function (Blueprint $table) {
|
||||
$table->dropColumn('reason');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
|
||||
class CreateTaggableTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('taggable_tags', function (Blueprint $table) {
|
||||
$table->increments('tag_id');
|
||||
$table->string('name');
|
||||
$table->string('normalized')->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('taggable_taggables', function (Blueprint $table) {
|
||||
$table->unsignedInteger('tag_id');
|
||||
$table->unsignedInteger('taggable_id');
|
||||
$table->string('taggable_type');
|
||||
$table->timestamps();
|
||||
$table->primary(['tag_id', 'taggable_id', 'taggable_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('taggable_tags');
|
||||
Schema::drop('taggable_taggables');
|
||||
}
|
||||
}
|
35
database/migrations/2017_01_04_113103_banners.php
Normal file
35
database/migrations/2017_01_04_113103_banners.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class Banners extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('banners', function(Blueprint $t) {
|
||||
$t->increments('id');
|
||||
$t->string('customer')->nullable();
|
||||
$t->string('url');
|
||||
$t->string('image');
|
||||
$t->boolean('sfw');
|
||||
$t->timestamp('until');
|
||||
$t->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('banners');
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveBackgroundFromUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->dropColumn('background');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table) {
|
||||
$table->boolean('background')->default(true)->after('email');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddDonationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('donations', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable();
|
||||
$table->string('url')->nullable();
|
||||
$table->float('amount', 5, 2);
|
||||
$table->string('payment_method')->nullable();
|
||||
$table->timestamp('timestamp');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('donations');
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeAmountTypeToDecimalInDonationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('donations', function(Blueprint $table) {
|
||||
$table->decimal('amount', 13, 4)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('donations', function(Blueprint $table) {
|
||||
$table->float('amount', 5, 2)->change();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixDefaultValuesInFavoritesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// raw sql because doctrine/dbal doesn't support the timestamp datatype
|
||||
DB::statement("
|
||||
ALTER TABLE favorites
|
||||
MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY COLUMN updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement("
|
||||
ALTER TABLE favorites
|
||||
MODIFY COLUMN created_at TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
MODIFY COLUMN updated_at TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'
|
||||
");
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddUniqueHashConstraintToVideosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('videos', function(Blueprint $table) {
|
||||
$table->unique('hash');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('videos', function(Blueprint $table) {
|
||||
$table->dropUnique('videos_hash_unique');
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddVideotitleColumnToVideoTable extends Migration
|
||||
{ /**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('videos', function (Blueprint $table) {
|
||||
$table->string('videotitle')->nullable()->after('file');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('videos', function (Blueprint $table) {
|
||||
$table->dropColumn('videotitle');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLayoutColumnToUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('layout')->unsigned()->default(1)->after('icon_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('layout');
|
||||
});
|
||||
}
|
||||
}
|
0
database/seeds/.gitkeep
Normal file
0
database/seeds/.gitkeep
Normal file
64
database/seeds/CategorySeeder.php
Normal file
64
database/seeds/CategorySeeder.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Category;
|
||||
|
||||
class CategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Category::create([
|
||||
'name' => 'Musicvideos',
|
||||
'shortname' => 'mv',
|
||||
'description' => 'WebMs containing music'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Anime',
|
||||
'shortname' => 'anime',
|
||||
'description' => 'Everything from AMV to Hentai'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Russia',
|
||||
'shortname' => 'russia',
|
||||
'description' => 'Сука Блять'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Asians',
|
||||
'shortname' => 'asians',
|
||||
'description' => 'Mostly Korean and Japanese girls'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Funny',
|
||||
'shortname' => 'funny',
|
||||
'description' => 'Supposed to be funny'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Pr0n',
|
||||
'shortname' => 'pr0n',
|
||||
'description' => 'Crazy Japanese porn you will find my son'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Politics',
|
||||
'shortname' => 'pol',
|
||||
'description' => 'Videos about faggots in suits'
|
||||
]);
|
||||
|
||||
Category::create([
|
||||
'name' => 'Misc',
|
||||
'shortname' => 'misc',
|
||||
'description' => 'Stuff that doesnt fit anywhere else'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
25
database/seeds/DatabaseSeeder.php
Normal file
25
database/seeds/DatabaseSeeder.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
$this->call(CategorySeeder::class);
|
||||
$this->call(VerifyUserSeeder::class);
|
||||
$this->call(VideoTableSeeder::class);
|
||||
$this->call(PermissionSeeder::class);
|
||||
$this->call(RoleSeeder::class);
|
||||
$this->call(FilterSeeder::class);
|
||||
|
||||
Model::reguard();
|
||||
}
|
||||
}
|
21
database/seeds/FilterSeeder.php
Normal file
21
database/seeds/FilterSeeder.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class FilterSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$cats = \App\Models\Category::lists('id');
|
||||
|
||||
foreach(\App\Models\User::withTrashed()->get() as $user) {
|
||||
$user->categories = $cats;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
27
database/seeds/PermissionSeeder.php
Normal file
27
database/seeds/PermissionSeeder.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use \Toddish\Verify\Models\Permission;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Permission::create(['name' => 'delete_user']);
|
||||
Permission::create(['name' => 'delete_video']);
|
||||
Permission::create(['name' => 'delete_category']);
|
||||
Permission::create(['name' => 'edit_user']);
|
||||
Permission::create(['name' => 'edit_video']);
|
||||
Permission::create(['name' => 'edit_category']);
|
||||
Permission::create(['name' => 'add_category']);
|
||||
Permission::create(['name' => 'edit_comment']);
|
||||
Permission::create(['name' => 'delete_comment']);
|
||||
Permission::create(['name' => 'break_upload_limit']);
|
||||
Permission::create(['name' => 'break_max_filesize']);
|
||||
}
|
||||
}
|
19
database/seeds/RoleSeeder.php
Normal file
19
database/seeds/RoleSeeder.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use \Toddish\Verify\Models\Role;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$mod = Role::create(['name' => 'Moderator', 'level' => 7]);
|
||||
$perms = \Toddish\Verify\Models\Permission::all(['id']);
|
||||
$mod->permissions()->sync($perms);
|
||||
}
|
||||
}
|
38
database/seeds/VerifyUserSeeder.php
Normal file
38
database/seeds/VerifyUserSeeder.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class VerifyUserSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$prefix = Config::get('verify.prefix', '');
|
||||
|
||||
$role_id = DB::table($prefix . 'roles')->insertGetId([
|
||||
'name' => Config::get('verify.super_admin'),
|
||||
'level' => 10,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$user_id = DB::table($prefix . 'users')->insertGetId([
|
||||
'username' => 'admin',
|
||||
'password' => '$2a$08$rqN6idpy0FwezH72fQcdqunbJp7GJVm8j94atsTOqCeuNvc3PzH3m',
|
||||
'salt' => 'a227383075861e775d0af6281ea05a49',
|
||||
'email' => 'admin@example.com',
|
||||
'verified' => 1,
|
||||
'disabled' => 0,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
DB::table($prefix . 'role_user')->insert([
|
||||
'role_id' => $role_id,
|
||||
'user_id' => $user_id,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$this->command->info('User table seeded!');
|
||||
}
|
||||
}
|
39
database/seeds/VideoTableSeeder.php
Normal file
39
database/seeds/VideoTableSeeder.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class VideoTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$videos = glob(public_path() . '/b/*');
|
||||
usort($videos, function($a, $b) {
|
||||
$a = (int) basename($a, '.webm');
|
||||
$b = (int) basename($b, '.webm');
|
||||
if ($a == $b) {
|
||||
return 0;
|
||||
}
|
||||
return ($a < $b) ? -1 : 1;
|
||||
});
|
||||
|
||||
$category = \App\Models\Category::where('shortname', '=', 'misc')->first();
|
||||
$user = \App\Models\User::find(1);
|
||||
|
||||
foreach($videos as $video) {
|
||||
if(\App\Models\Video::whereFile(basename($video))->count() > 0)
|
||||
continue;
|
||||
|
||||
$v = new \App\Models\Video();
|
||||
$v->user()->associate($user);
|
||||
$v->category()->associate($category);
|
||||
$v->hash = sha1_file($video);
|
||||
$v->file = basename($video);
|
||||
$v->save();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user