From 92a47d5c24000c9a8fec4bceb3379ac03f77010c Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Thu, 8 Feb 2018 14:12:42 +0200 Subject: [PATCH] add slack attachement pretext attribute --- .../Channels/SlackWebhookChannel.php | 1 + .../Messages/SlackAttachment.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php index 71442d8c3db2..9eaa29116a09 100644 --- a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php +++ b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php @@ -85,6 +85,7 @@ protected function attachments(SlackMessage $message) 'author_icon' => $attachment->authorIcon, 'author_link' => $attachment->authorLink, 'author_name' => $attachment->authorName, + 'pretext' => $attachment->pretext, 'color' => $attachment->color ?: $message->color(), 'fallback' => $attachment->fallback, 'fields' => $this->fields($attachment), diff --git a/src/Illuminate/Notifications/Messages/SlackAttachment.php b/src/Illuminate/Notifications/Messages/SlackAttachment.php index c949a5e0ab47..3b48ead04669 100644 --- a/src/Illuminate/Notifications/Messages/SlackAttachment.php +++ b/src/Illuminate/Notifications/Messages/SlackAttachment.php @@ -29,6 +29,13 @@ class SlackAttachment */ public $content; + /** + * The attachment's pre-text. + * + * @var string + */ + public $pretext; + /** * A plain-text summary of the attachment. * @@ -141,6 +148,19 @@ public function content($content) return $this; } + /** + * Set the Pre-text of the attachment. + * + * @param string $pretext + * @return $this + */ + public function pretext($pretext) + { + $this->pretext = $pretext; + + return $this; + } + /** * A plain-text summary of the attachment. *