Data Model and Migrations (Selected Highlights)
Websites Table
The websites table powers multi-site, multi-brand event management. It captures branding, marketing, payments, integrations, and operational settings in one place.
// database/migrations/2023_01_01_200723_create_websites_table.php
Schema::create('websites', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->timestamp('deleted_at')->nullable();
// Branding & Identity
$table->string('name');
$table->string('logo')->nullable();
$table->string('color')->nullable();
$table->string('icon')->nullable();
$table->string('abbreviation', 10)->nullable();
$table->string('slug')->nullable();
$table->string('url')->nullable();
// Social & Marketing
$table->string('twitter_url')->nullable();
$table->string('instagram_url')->nullable();
$table->string('facebook_url')->nullable();
$table->string('tiktok_url')->nullable()->default(null);
$table->longText('ga_script')->nullable();
$table->string('contact_email')->nullable();
$table->string('body_scripts')->nullable();
$table->string('zendesk_bot_key')->nullable();
$table->string('helpful_links_image')->nullable();
// WordPress Integration
$table->integer('wordpress_site_id');
// Stripe Checkout & Payments
$table->string('statement_descriptor_prefix', 25)->nullable();
// Season & Sport
$table->integer('current_season')->nullable();
$table->string('sport')->nullable();
$table->json('sport_positions')->nullable();
// Additional Operations
$table->boolean('save_to_play')->default(false);
$table->string('stp_how_to_book')->nullable();
$table->string('stp_faq')->nullable();
// Watermark for tickets, marketing collateral
$table->string('watermark');
// Soft foreign keys & legacy fields (cleaned up in later migrations)
$table->unsignedBigInteger('parent_id')->nullable();
$table->foreign('parent_id')->references('id')->on('websites')->onDelete('set null');
$table->string('rm_slug', 10)->nullable();
$table->string('consumer_key')->nullable();
$table->string('consumer_secret')->nullable();
$table->string('AAPID')->nullable();
$table->string('wp_app_password')->nullable();
});
Key Columns
| Column | Type | Purpose |
|---|---|---|
| id | bigint | Primary key |
| name, logo, color, icon, slug | strings | Branding & UI theming |
| twitter_url, facebook_url, … | strings | Social media links |
| wordpress_site_id | integer | Integrates with WordPress REST API |
| statement_descriptor_prefix | string(25) | Prefix for Stripe statement descriptors |
| current_season | integer | Controls “current season” context in queries |
| sport_positions | json | Mapping positions per sport (e.g. Guard, Forward for Basketball) |
| sport | string | Sport name |
| save_to_play | boolean | Toggles Save-to-Play feature |
| stp_how_to_book, stp_faq | strings | Links for “Save to Play” instructional pages |
| watermark | string | URL to watermark overlay for tickets |
| parent_id | fk → id | Enables site-hierarchy (e.g., network → regional sites) |
| rm_slug, consumer_key, … | legacy | Deprecated OAuth/WordPress fields (removed later) |
| (…fields added or removed via subsequent migrations) |
Website Model
The Eloquent Website model encapsulates business logic and casts for JSON columns and booleans.
// app/Models/Website.php
class Website extends Model
{
use HasFactory;
protected $guarded = ['id'];
protected function casts(): array
{
return [
'sport_positions' => 'array',
'save_to_play' => 'boolean',
'registration_page_settings' => 'array',
'divisions' => 'array',
'event_interest' => 'boolean',
'disallowed_domains' => 'array',
];
}
// Returns current_season or fallback to current year
public function currentSeason(): string
{
return $this->current_season ?: date('Y');
}
// Load JSON-driven event resources per site
public function eventResources()
{
return EventResource::whereJson('website_id', $this->id)
->orWhereNull('website_id')->get();
}
// Dynamic support links via site name
public function supportLink(): string
{
$sub = strtolower(str_replace(' ', '', $this->name));
return "https://{$sub}.zendesk.com/hc/en-us/requests/new";
}
public function supportEmail(): string
{
$sub = strtolower(str_replace(' ', '', $this->name));
return "support@{$sub}.zendesk.com";
}
}
- Guards & Casts simplify handling of JSON columns and booleans.
- Helper methods centralize generation of support links and season fallback.
Core Relationships & Pivot Tables
Programs ↔ Websites (Many-to-Many)
-
Migration
Schema::create('program_websites', function (Blueprint $table) { $table->id(); $table->foreignId('program_id')->constrained()->onDelete('cascade'); $table->foreignId('website_id')->constrained()->onDelete('cascade'); $table->timestamps(); $table->unique(['program_id','website_id']); }); -
Program Model Snippet
class Program extends Model { public function websites() { return $this->belongsToMany(Website::class, 'program_websites'); } } -
Website Model
public function programs() { return $this->belongsToMany(Program::class, 'program_websites'); }
Events → Website (One-to-Many)
eventstable includeswebsite_idforeign key. Each event belongs to one site.- Event Factory sets
website_idusing the Website factory.
Programs → Website (One-to-Many)**
- Initial
programstable haswebsite_idcolumn.
Entity Relationship Diagram
erDiagram
WEBSITE ||--o{ PROGRAM_WEBSITES : has
PROGRAM ||--o{ PROGRAM_WEBSITES : has
WEBSITE ||--o{ EVENTS : hosts
WEBSITE ||--o{ PROGRAMS : owns
Selected Migrations Timeline
| Date | Migration | Purpose |
|---|---|---|
| 2023-01-01 | create_websites_table | Initial table creation |
| 2024-11-05 | add_parent_id_to_websites_table | Self-referential parent_id |
| 2024-12-07 | cleanup_websites_table | Dropped legacy OAuth fields |
| 2025-02-18 | add_registration_settings_to_websites_table | JSON for checkout pages |
| 2025-02-07 | add_braze_sms_group_id_to_websites_table | Braze SMS integration |
Card Block:
{
"title": "Multi-Site Support",
"content": "Websites table drives multi-site branding, checkout, and reporting."
}
This section highlights how the websites table centralizes branding, integrations (Stripe, WordPress, Braze), season control, and marketing settings to enable a flexible, multi-brand event platform .