Initial Commit

The initial public commit of MVGL website code.
This commit is contained in:
Jimmy B. 2024-01-14 13:51:43 -06:00
commit b39ecf1638
2043 changed files with 215154 additions and 0 deletions

2
database/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.sqlite
*.sqlite-journal

View file

@ -0,0 +1,34 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'first_name' => $this->faker->firstName,
'last_name' => $this->faker->lastName,
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
}

View file

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username')->unique()->index();
$table->string('password');
$table->string('email')->unique()->index();
$table->integer('role_id')->default(6)->index();
$table->string('avatar')->default('default.png');
$table->string('coverpic')->default('default.png');
$table->text('bio')->nullable()->default(null);
$table->string('status')->nullable()->default(null);
$table->string('api_token')->nullable()->default(null);
$table->string('stripe_id')->nullable()->default(null);
$table->integer('profile_views')->default(0);
$table->integer('blog_views')->default(0);
$table->enum('banned', ['Y', 'N'])->default('N');
$table->enum('user_deleted', ['Y', 'N'])->default('N');
$table->timestamp('email_verified_at')->nullable();
$table->rememberToken();
$table->ipAddress();
$table->timestamps();
$table->timestamp('last_activity')->nullable()->default(null);
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
};

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};

View file

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_gamer_tags', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index()->unique()->unsigned();
$table->string('xbox_live')->nullable()->default(null);
$table->string('wii')->nullable()->default(null);
$table->string('wii_u')->nullable()->default(null);
$table->string('3ds')->nullable()->default(null);
$table->string('nintendo_id')->nullable()->default(null);
$table->string('nintendo_switch_id')->nullable()->default(null);
$table->string('psn')->nullable()->default(null);
$table->string('steam')->nullable()->default(null);
$table->string('battle_net')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_gamer_tags');
}
};

View file

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_infos', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unique()->index()->unsigned();
$table->string('location')->nullable()->default(null);
$table->string('website')->nullable()->default(null);
$table->string('facebook')->nullable()->default(null);
$table->string('twitter')->nullable()->default(null);
$table->string('instagram')->nullable()->default(null);
$table->string('myanimelist')->nullable()->default(null);
$table->string('true_achievements')->nullable()->default(null);
$table->string('true_trophies')->nullable()->default(null);
$table->string('twitch')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_infos');
}
};

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_notification_settings', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unique()->index()->unsigned();
$table->enum('comment_on_your_profile', ['Y', 'N'])->default('N');
$table->enum('previously_left_comment_on_game', ['Y', 'N'])->default('N');
$table->enum('comment_for_game_on_list', ['Y', 'N'])->default('N');
$table->enum('comment_on_your_review', ['Y', 'N'])->default('N');
$table->enum('previously_left_comment_on_review', ['Y', 'N'])->default('N');
$table->enum('friend_added_you', ['Y', 'N'])->default('N');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_notification_settings');
}
};

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('roles');
}
};

View file

@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('games', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('alt_titles')->nullable()->default(null);
$table->integer('platform_id')->index()->unsigned();
$table->text('description')->nullable()->default(null);
$table->string('source')->nullable()->default(null);
$table->string('boxart')->nullable()->default(null);
$table->string('genre_ids')->nullable()->default(null);
$table->string('developers')->nullable()->default(null);
$table->string('publishers')->nullable()->default(null);
$table->string('composers')->nullable()->default(null);
$table->string('website')->nullable()->default(null);
$table->timestamp('na_release_date')->nullable()->default(null);
$table->timestamp('jp_release_date')->nullable()->default(null);
$table->timestamp('eu_release_date')->nullable()->default(null);
$table->timestamp('aus_release_date')->nullable()->default(null);
$table->enum('esrb_rating', ['Everyone', 'Everyone 10+', 'Teen', 'Mature 17+', 'Adults Only 18+', 'Rating Pending', 'Rating Pending - Likely Mature 17+'])->nullable()->default(null); // phpcs:ignore
$table->enum('pegi_rating', ['PEGI 3', 'PEGI 7', 'PEGI 12', 'PEGI 16', 'PEGI 18'])->nullable()->default(null); // phpcs:ignore
$table->enum('cero_rating', ['CERO A', 'CERO B', 'CERO C', 'CERO D', 'CERO Z'])->nullable()->default(null); // phpcs:ignore
$table->enum('acb_rating', ['E', 'G', 'PG', 'M', 'MA 15+', 'R 18+', 'X 18+'])->nullable()->default(null);
$table->integer('requested_by')->index()->unsigned();
$table->integer('added_by')->index()->unsigned();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('games');
}
};

View file

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('game_lists', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index()->unsigned();
$table->integer('game_id')->index()->unsigned();
$table->enum('ownership', [1, 2, 3, 4])->nullable()->default(null);
$table->enum('status', [1, 2, 3, 4, 5, 6])->index()->default(1);
$table->enum('rating', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])->index()->nullable()->default(null);
$table->enum('priority', ['Low', 'Medium', 'High'])->nullable()->default(null);
$table->enum('difficulty', ['Easy', 'Medium', 'Hard', 'Extremely Hard'])->nullable()->default(null);
$table->enum('hours_played', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])->nullable()->default(null);
$table->enum('replay_value', [1, 2, 3, 4, 5])->nullable()->default(null);
$table->timestamp('start_date')->nullable()->default(null);
$table->timestamp('finish_date')->nullable()->default(null);
$table->enum('is_replaying', ['Y', 'N'])->nullable()->default('N');
$table->text('notes')->nullable()->default(null);
$table->ipAddress('ip_address')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('game_lists');
}
};

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('console_lists', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index()->unsigned();
$table->string('consoles')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('consoles');
}
};

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('platforms', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('platforms');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('profile_comments', function (Blueprint $table) {
$table->id();
$table->integer('recipient_id')->index()->unsigned();
$table->integer('sender_id')->index()->unsigned();
$table->text('comment');
$table->ipAddress('ip_address')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('profile_comments');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('game_comments', function (Blueprint $table) {
$table->id();
$table->integer('game_id')->index()->unsigned();
$table->integer('user_id')->index()->unsigned();
$table->text('comment');
$table->ipAddress('ip_address')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('game_comments');
}
};

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('genres', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->ipAddress('ip_address')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('genres');
}
};

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('list_views')->after('profile_views')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('list_views');
});
}
};

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('game_lists', function (Blueprint $table) {
$table->string('name')->after('game_id');
$table->integer('platform_id')->after('name')->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('game_lists', function (Blueprint $table) {
$table->dropColumn('name');
$table->dropColumn('platform_id');
});
}
};

View file

@ -0,0 +1,27 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) { // phpcs:ignore
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
}
};

View file

@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->string('event')->nullable()->after('subject_type');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('event');
});
}
};

View file

@ -0,0 +1,22 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
public function up()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->uuid('batch_uuid')->nullable()->after('properties');
});
}
public function down()
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
}
};

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_site_settings', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index()->unsigned();
$table->string('setting_name');
$table->string('setting_value');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_site_settings');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wishlists', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unsigned()->index();
$table->integer('game_id')->unsigned()->index();
$table->integer('sort_order')->unsigned()->index();
$table->ipAddress('ip_address')->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wishlists');
}
};

View file

@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
UsersSeeder::class,
// PermissionsSeeder::class,
// RolesSeeder::class,
]);
}
}

View file

@ -0,0 +1,55 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
class PermissionsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
$data = $this->data();
foreach ($data as $value) {
Permission::create([
'name' => $value['name'],
]);
}
}
public function data()
{
$data = [];
// list of model permission
$model = ['content', 'user', 'role', 'permission'];
foreach ($model as $value) {
foreach ($this->crudActions($value) as $action) {
$data[] = ['name' => $action];
}
}
return $data;
}
public function crudActions($name)
{
$actions = [];
// list of permission actions
$crud = ['create', 'read', 'update', 'delete'];
foreach ($crud as $value) {
$actions[] = $value . ' ' . $name;
}
return $actions;
}
}

View file

@ -0,0 +1,33 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class RolesSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$data = $this->data();
foreach ($data as $value) {
Role::create([
'name' => $value['name'],
]);
}
}
public function data()
{
return [
['name' => 'admin'],
['name' => 'editor'],
];
}
}

View file

@ -0,0 +1,62 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use App\Models\UserInfo;
use Faker\Generator;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class UsersSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run(Generator $faker)
{
$demoUser = User::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => 'demo@demo.com',
'password' => Hash::make('demo'),
'email_verified_at' => now(),
]);
$this->addDummyInfo($faker, $demoUser);
$demoUser2 = User::create([
'first_name' => $faker->firstName,
'last_name' => $faker->lastName,
'email' => 'admin@demo.com',
'password' => Hash::make('demo'),
'email_verified_at' => now(),
]);
$this->addDummyInfo($faker, $demoUser2);
User::factory(100)->create()->each(function (User $user) use ($faker) {
$this->addDummyInfo($faker, $user);
});
}
private function addDummyInfo(Generator $faker, User $user)
{
$dummyInfo = [
'company' => $faker->company,
'phone' => $faker->phoneNumber,
'website' => $faker->url,
'language' => $faker->languageCode,
'country' => $faker->countryCode,
];
$info = new UserInfo();
foreach ($dummyInfo as $key => $value) {
$info->$key = $value;
}
$info->user()->associate($user);
$info->save();
}
}