From cd4960b637224511584982e2b29a1bdb504fd592 Mon Sep 17 00:00:00 2001 From: Kenneth Date: Tue, 4 Apr 2017 11:13:15 -0700 Subject: [PATCH] Support for image_url property within Slack attachments --- .../Channels/SlackWebhookChannel.php | 1 + .../Messages/SlackAttachment.php | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php index c8186e8b65a9..32ab3bdd1c59 100644 --- a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php +++ b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php @@ -89,6 +89,7 @@ protected function attachments(SlackMessage $message) 'footer' => $attachment->footer, 'footer_icon' => $attachment->footerIcon, 'ts' => $attachment->timestamp, + 'image_url' => $attachment->imageUrl, ]); })->all(); } diff --git a/src/Illuminate/Notifications/Messages/SlackAttachment.php b/src/Illuminate/Notifications/Messages/SlackAttachment.php index 6ae6dcdfaca3..0ec90712e23b 100644 --- a/src/Illuminate/Notifications/Messages/SlackAttachment.php +++ b/src/Illuminate/Notifications/Messages/SlackAttachment.php @@ -76,6 +76,13 @@ class SlackAttachment */ public $timestamp; + /** + * The attachment's image url. + * + * @var string + */ + public $imageUrl; + /** * Set the title of the attachment. * @@ -218,4 +225,18 @@ public function timestamp(Carbon $timestamp) return $this; } + + /** + * Set the image url. + * + * @param string $url + * + * @return $this + */ + public function imageUrl($url) + { + $this->imageUrl = $url; + + return $this; + } }