fix: replace fake()->userName() with Str::random() in Mailbox component to fix production crash
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\Email;
|
|||||||
use App\Models\EmailBody;
|
use App\Models\EmailBody;
|
||||||
use App\Models\Mailbox as MailboxModel;
|
use App\Models\Mailbox as MailboxModel;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\WithPagination;
|
use Livewire\WithPagination;
|
||||||
@@ -219,7 +220,7 @@ class Mailbox extends Component
|
|||||||
|
|
||||||
if ($this->createType === 'random') {
|
if ($this->createType === 'random') {
|
||||||
do {
|
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());
|
} while (MailboxModel::withTrashed()->where('address', $address)->exists());
|
||||||
} else {
|
} else {
|
||||||
$address = $this->customUsername.'@'.$this->customDomain;
|
$address = $this->customUsername.'@'.$this->customDomain;
|
||||||
@@ -327,7 +328,7 @@ class Mailbox extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
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());
|
} while (MailboxModel::withTrashed()->where('address', $address)->exists());
|
||||||
|
|
||||||
$mailbox = MailboxModel::create([
|
$mailbox = MailboxModel::create([
|
||||||
|
|||||||
Reference in New Issue
Block a user