Skip to content

Commit

Permalink
Made username parameter nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
mho22 committed Jul 14, 2024
1 parent fff9b03 commit 8f1f08e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,12 @@
'webhook_url' => '',

/*
* If this is an empty string, the name field on the webhook will be used.
* If this is an empty string, the name field will be 'Laravel Backup'.
* If this is set to null, the name field on the webhook will be used.
*/
'username' => '',

/*
* If this is an empty string, the avatar on the webhook will be used.
*/
'avatar_url' => '',
'avatar_url' => null,
],
],

Expand Down
4 changes: 2 additions & 2 deletions src/Notifications/Channels/Discord/DiscordMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DiscordMessage
public const COLOR_WARNING = 'fD6a02';
public const COLOR_ERROR = 'e32929';

protected string $username = 'Laravel Backup';
protected ?string $username = null;

protected ?string $avatarUrl = null;

Expand All @@ -31,7 +31,7 @@ class DiscordMessage
public function from(?string $username = null, ?string $avatarUrl = null): self
{
if (! is_null($username)) {
$this->username = $username;
$this->username = empty($username) ? 'Laravel Backup' : $username;
}

if (! is_null($avatarUrl)) {
Expand Down

0 comments on commit 8f1f08e

Please sign in to comment.