@php use Illuminate\Support\Facades\Schema; $smtpPoolServers = $smtp_pool_servers ?? collect(); $poolTableReady = Schema::hasTable('smtp_pool_servers'); $smtpPoolEnabled = (bool) old('smtp_pool_enabled', $general_setting->smtp_pool_enabled ?? false); $errorThreshold = (int) old('smtp_pool_error_threshold', $general_setting->smtp_pool_error_threshold ?? 2); if ($smtpPoolServers->isEmpty() && ! empty($email_setting?->mail_host)) { $legacy = (object) [ 'name' => 'Principal', 'sender_name' => $email_setting->sender_name, 'mail_host' => $email_setting->mail_host, 'mail_port' => $email_setting->mail_port, 'email' => $email_setting->email, 'smtp_username' => $email_setting->smtp_username, 'smtp_password' => $email_setting->smtp_password, 'mail_encryption' => $email_setting->mail_encryption, 'role' => 'general', 'notify_registration_password' => true, 'notify_listings_booking' => true, 'notify_messages' => true, 'priority' => 10, 'monthly_email_limit' => 0, 'is_enabled' => true, ]; $serverRows = collect([$legacy]); } else { $serverRows = $smtpPoolServers->isNotEmpty() ? $smtpPoolServers : collect([null]); } @endphp