Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Setup additional configuration for Slack Client. #15882

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ protected function buildJsonPayload(SlackMessage $message)
'channel' => data_get($message, 'channel'),
]);

return [
$payload = [
'json' => array_merge([
'text' => $message->content,
'attachments' => $this->attachments($message),
], $optionalFields),
];

// Add other configuration settings if available.
if (! empty($message->options)) {
$payload = array_merge($payload, $message->options);
}

return $payload;
}

/**
Expand Down
20 changes: 20 additions & 0 deletions src/Illuminate/Notifications/Messages/SlackMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class SlackMessage
*/
public $attachments = [];

/**
* Additional settings for Slack HTTP Client.
*
* @var array
*/
public $options = [];

/**
* Indicate that the notification gives information about a successful operation.
*
Expand Down Expand Up @@ -145,4 +152,17 @@ public function color()
return '#F35A00';
}
}

/**
* Setup additional configuration for Slack HTTP Client.
*
* @param array $options
* @return $this
*/
public function options($options)
{
$this->options = $options;

return $this;
}
}