Skip to content

Commit 98b8b73

Browse files
RVxLabfreekmurze
authored andcommitted
Only add the username property if it's not empty
1 parent d859659 commit 98b8b73

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Notifications/Channels/Discord/DiscordMessage.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ public function fields(array $fields, bool $inline = true): self
110110

111111
public function toArray(): array
112112
{
113-
return [
114-
'username' => $this->username ?? 'Laravel Backup',
113+
$data = [
115114
'avatar_url' => $this->avatarUrl,
116115
'embeds' => [
117116
[
@@ -128,5 +127,11 @@ public function toArray(): array
128127
],
129128
],
130129
];
130+
131+
if (!empty($this->username)) {
132+
$data['username'] = $this->username;
133+
}
134+
135+
return $data;
131136
}
132137
}

0 commit comments

Comments
 (0)