fix: replace fake()->userName() with Str::random() in Mailbox component to fix production crash

This commit is contained in:
idevakk
2026-03-10 01:05:27 +05:30
parent 323ff11747
commit 77c09220b0

View File

@@ -8,6 +8,7 @@ use App\Models\Email;
use App\Models\EmailBody;
use App\Models\Mailbox as MailboxModel;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
use Livewire\Attributes\Layout;
use Livewire\Component;
use Livewire\WithPagination;
@@ -219,7 +220,7 @@ class Mailbox extends Component
if ($this->createType === 'random') {
do {
$address = fake()->userName().rand(10, 99).'@'.$this->customDomain;
$address = Str::lower(Str::random(6)).rand(10, 99).'@'.$this->customDomain;
} while (MailboxModel::withTrashed()->where('address', $address)->exists());
} else {
$address = $this->customUsername.'@'.$this->customDomain;
@@ -327,7 +328,7 @@ class Mailbox extends Component
}
do {
$address = fake()->userName().rand(10, 99).'@'.$domain->name;
$address = Str::lower(Str::random(6)).rand(10, 99).'@'.$domain->name;
} while (MailboxModel::withTrashed()->where('address', $address)->exists());
$mailbox = MailboxModel::create([