Initial Commit

This commit is contained in:
Mark Gregory
2026-09-12 20:21:11 +01:00
commit 35d3f344c8
62 changed files with 3215 additions and 0 deletions
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -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.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,59 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedSmallInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('connection');
$table->string('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->index(['connection', 'queue', 'failed_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,129 @@
<?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('businesses', function (Blueprint $t) {
$t->ulid('id')->primary();
$t->string('name');
$t->string('slug')->unique();
$t->text('description')->nullable();
$t->string('email')->nullable();
$t->string('phone')->nullable();
$t->string('website')->nullable();
$t->string('status')->default('active');
$t->timestamp('verified_at')->nullable();
$t->timestamps();
});
Schema::create('business_user', function (Blueprint $t) {
$t->id();
$t->ulid('business_id');
$t->foreignId('user_id')->constrained()->cascadeOnDelete();
$t->string('role')->default('member');
$t->timestamps();
$t->unique(['business_id', 'user_id']);
});
Schema::create('dj_profiles', function (Blueprint $t) {
$t->ulid('id')->primary();
$t->foreignId('user_id')->constrained()->cascadeOnDelete();
$t->ulid('business_id')->nullable();
$t->string('stage_name');
$t->string('slug')->unique();
$t->string('headline')->nullable();
$t->text('bio')->nullable();
$t->string('city')->index();
$t->unsignedSmallInteger('service_radius_miles')->default(30);
$t->decimal('price_from', 10, 2)->nullable();
$t->string('profile_photo')->nullable();
$t->string('cover_photo')->nullable();
$t->timestamp('verified_at')->nullable();
$t->boolean('is_featured')->default(false);
$t->boolean('is_published')->default(false);
$t->decimal('average_rating', 3, 2)->default(0);
$t->unsignedInteger('review_count')->default(0);
$t->timestamps();
});
Schema::create('genres', function (Blueprint $t) {
$t->id();
$t->string('name');
$t->string('slug')->unique();
$t->timestamps();
});
Schema::create('dj_profile_genre', function (Blueprint $t) {
$t->ulid('dj_profile_id');
$t->foreignId('genre_id')->constrained()->cascadeOnDelete();
$t->primary(['dj_profile_id', 'genre_id']);
});
Schema::create('enquiries', function (Blueprint $t) {
$t->ulid('id')->primary();
$t->foreignId('user_id')->constrained();
$t->ulid('dj_profile_id');
$t->string('event_type');
$t->date('event_date');
$t->time('start_time')->nullable();
$t->time('end_time')->nullable();
$t->string('venue');
$t->string('postcode')->nullable();
$t->unsignedInteger('guest_count')->nullable();
$t->decimal('budget', 10, 2)->nullable();
$t->text('message');
$t->string('status')->default('new')->index();
$t->timestamps();
});
Schema::create('bookings', function (Blueprint $t) {
$t->ulid('id')->primary();
$t->ulid('enquiry_id')->nullable();
$t->foreignId('client_id')->constrained('users');
$t->ulid('dj_profile_id');
$t->date('event_date');
$t->decimal('total', 10, 2);
$t->decimal('deposit', 10, 2)->default(0);
$t->string('status')->default('pending')->index();
$t->timestamp('paid_at')->nullable();
$t->timestamps();
});
Schema::create('reviews', function (Blueprint $t) {
$t->ulid('id')->primary();
$t->ulid('booking_id');
$t->foreignId('user_id')->constrained();
$t->ulid('dj_profile_id');
$t->unsignedTinyInteger('rating');
$t->string('title')->nullable();
$t->text('body');
$t->string('status')->default('pending')->index();
$t->text('dj_reply')->nullable();
$t->timestamps();
});
Schema::create('cookie_consents', function (Blueprint $t) {
$t->id();
$t->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$t->string('anonymous_id')->nullable()->index();
$t->boolean('analytics')->default(false);
$t->boolean('marketing')->default(false);
$t->string('policy_version');
$t->timestamp('consented_at');
$t->timestamps();
});
Schema::create('audit_logs', function (Blueprint $t) {
$t->id();
$t->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$t->string('action')->index();
$t->nullableMorphs('subject');
$t->json('meta')->nullable();
$t->string('ip_hash', 64)->nullable();
$t->timestamps();
});
}
public function down(): void
{
foreach (['audit_logs', 'cookie_consents', 'reviews', 'bookings', 'enquiries', 'dj_profile_genre', 'genres', 'dj_profiles', 'business_user', 'businesses'] as $x) {
Schema::dropIfExists($x);
}
}
};
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace Database\Seeders;
use App\Models\DjProfile;
use App\Models\Genre;
use App\Models\User;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class DatabaseSeeder extends Seeder
{
public function run(): void
{
foreach (['super-admin', 'admin', 'dj', 'client', 'moderator', 'support'] as $r) {
Role::firstOrCreate(['name' => $r]);
} $admin = User::firstOrCreate(['email' => 'admin@beatbook.test'], ['name' => 'BeatBook Admin', 'password' => 'password']);
$admin->assignRole('admin');
$djUser = User::firstOrCreate(['email' => 'dj@beatbook.test'], ['name' => 'Luna Hart', 'password' => 'password']);
$djUser->assignRole('dj');
User::firstOrCreate(['email' => 'client@beatbook.test'], ['name' => 'Demo Client', 'password' => 'password'])->assignRole('client');
$dj = DjProfile::firstOrCreate(['slug' => 'dj-luna'], ['user_id' => $djUser->id, 'stage_name' => 'DJ Luna', 'headline' => 'Weddings · House · Chart · Private events', 'bio' => 'Award-winning mobile DJ bringing polished production, packed dance floors and a personal soundtrack to weddings and events.', 'city' => 'London', 'price_from' => 350, 'profile_photo' => 'https://images.unsplash.com/photo-1516280440614-37939bbacd81?auto=format&fit=crop&w=900&q=85', 'cover_photo' => 'https://images.unsplash.com/photo-1571266028243-d220c9c3b2d2?auto=format&fit=crop&w=1800&q=85', 'verified_at' => now(), 'is_featured' => true, 'is_published' => true, 'average_rating' => 4.9, 'review_count' => 128]);
foreach (['House', 'Chart', 'Wedding', 'R&B'] as $g) {
$genre = Genre::firstOrCreate(['slug' => strtolower(str_replace('&', 'and', $g))], ['name' => $g]);
$dj->genres()->syncWithoutDetaching($genre);
}
}
}