*/ public const TABLES = [ 'sites', 'properties', 'guests', 'bookings', 'channels', 'portal_emails', 'photos', 'pages', 'appearances', 'notices', 'faqs', 'blocked_periods', 'amenities', 'reviews', 'channel_tasks', 'payments', 'seasons', 'extras', 'special_offers', 'channel_sync_logs', 'content_blocks', ]; public static function run(): void { $pending = false; foreach (self::TABLES as $table) { if (DB::table($table)->whereNull('tenant_id')->exists()) { $pending = true; break; } } if (! $pending) { return; } $tenantId = DB::table('tenants')->where('slug', 'stommer')->value('id'); if ($tenantId === null) { $tenantId = DB::table('tenants')->insertGetId([ 'name' => 'Stommer', 'slug' => 'stommer', 'is_active' => true, 'created_at' => now(), 'updated_at' => now(), ]); } foreach (self::TABLES as $table) { DB::table($table)->whereNull('tenant_id')->update(['tenant_id' => $tenantId]); } } }