diff --git a/src/Notifications/Channels/Discord/DiscordMessage.php b/src/Notifications/Channels/Discord/DiscordMessage.php index 8854aef2..873655f7 100644 --- a/src/Notifications/Channels/Discord/DiscordMessage.php +++ b/src/Notifications/Channels/Discord/DiscordMessage.php @@ -110,8 +110,7 @@ public function fields(array $fields, bool $inline = true): self public function toArray(): array { - return [ - 'username' => $this->username ?? 'Laravel Backup', + $data = [ 'avatar_url' => $this->avatarUrl, 'embeds' => [ [ @@ -128,5 +127,11 @@ public function toArray(): array ], ], ]; + + if (!empty($this->username)) { + $data['username'] = $this->username; + } + + return $data; } }