finish off for today

This commit is contained in:
2025-09-02 23:41:57 +02:00
parent 2bffbfafda
commit 77c22fed35
10 changed files with 203 additions and 12 deletions

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('user');
$table->decimal('balance', 10, 2)->default(0.00);
$table->enum('account_status', ['active', 'suspended', 'banned'])->default('active');
$table->enum('kyc_status', ['pending', 'verified', 'rejected'])->default('pending');
$table->string('kyc_document_path')->nullable(); // For future KYC file uploads
$table->timestamp('last_login')->nullable();
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['role', 'balance', 'account_status', 'kyc_status', 'kyc_document_path', 'last_login']);
});
}
};

View File

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->enum('type', ['win', 'loss', 'deposit', 'withdraw', 'promo', 'adjustment']);
$table->decimal('amount', 10, 2);
$table->string('description')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('transactions');
}
};

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('promo_codes', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->decimal('value', 10, 2);
$table->boolean('used')->default(false);
$table->foreignId('user_id')->nullable()->constrained();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('promo_codes');
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('site_settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('value');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('site_settings');
}
};

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('audit_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained();
$table->string('action');
$table->json('details')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('audit_logs');
}
};

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('chats', function (Blueprint $table) {
$table->id();
$table->string('room'); // e.g., 'lobby' or 'game_1'
$table->foreignId('user_id')->constrained();
$table->text('message');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('chats');
}
};

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('games', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('enabled')->default(true);
$table->decimal('win_probability', 5, 2)->default(50.00);
$table->decimal('min_bet', 10, 2)->default(1.00);
$table->decimal('max_bet', 10, 2)->default(100.00);
$table->text('description')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('games');
}
};