updates for admin area

This commit is contained in:
Mark Gregory
2026-09-12 21:18:19 +01:00
parent ab3134de13
commit 5e2f4a1fa7
42 changed files with 894 additions and 210 deletions
@@ -0,0 +1,107 @@
<?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('payments', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->foreignUlid('booking_id')->nullable()->constrained('bookings')->nullOnDelete();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->decimal('amount', 10, 2);
$table->string('provider')->default('manual');
$table->string('reference')->nullable()->index();
$table->string('status')->default('pending')->index();
$table->timestamp('paid_at')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
});
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->foreignId('from_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('to_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->string('subject');
$table->text('body');
$table->string('status')->default('unread')->index();
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
Schema::create('admin_notifications', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->text('body');
$table->string('audience')->default('all')->index();
$table->string('status')->default('draft')->index();
$table->timestamp('published_at')->nullable();
$table->timestamps();
});
Schema::create('support_tickets', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('subject');
$table->string('category')->default('general');
$table->string('priority')->default('normal')->index();
$table->string('status')->default('open')->index();
$table->text('description');
$table->text('resolution')->nullable();
$table->timestamps();
});
Schema::create('saved_reports', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('type')->default('overview');
$table->text('description')->nullable();
$table->json('filters')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
});
Schema::create('content_pages', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->text('excerpt')->nullable();
$table->longText('body')->nullable();
$table->string('status')->default('draft')->index();
$table->timestamp('published_at')->nullable();
$table->timestamps();
});
Schema::create('legal_documents', function (Blueprint $table) {
$table->id();
$table->string('type')->index();
$table->string('title');
$table->string('version')->default('1.0');
$table->longText('body');
$table->string('status')->default('draft')->index();
$table->timestamp('published_at')->nullable();
$table->timestamps();
});
Schema::create('app_settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('label');
$table->text('value')->nullable();
$table->string('type')->default('text');
$table->string('group')->default('general')->index();
$table->text('description')->nullable();
$table->timestamps();
});
}
public function down(): void
{
foreach (['app_settings', 'legal_documents', 'content_pages', 'saved_reports', 'support_tickets', 'admin_notifications', 'messages', 'payments'] as $table) {
Schema::dropIfExists($table);
}
}
};