Permalink
Browse files

Format the meta content for Slack attachments (#46)

* Fix slack attachments
* Update Slack.php
* Formatting
  • Loading branch information...
alin-o authored and laurencei committed May 30, 2018
1 parent 34e6a1a commit af5f44e51cfe130baba1452ee1e656af29f690b8
Showing with 20 additions and 1 deletion.
  1. +20 −1 app/Notifications/Drivers/Slack.php
@@ -32,7 +32,7 @@ public function fire($recipient, $message)
'attachments' => [[
'text' => $message->markupDescription(),
'color' => $message->isError() ? 'danger' : 'good',
'fields' => $message->meta()
'fields' => $this->parseMeta($message->meta())
]]
];
@@ -46,4 +46,23 @@ public function fire($recipient, $message)
}
}
/**
* Format the meta content for Slack attachments.
*
* @param array $meta
* @return array
*/
protected function parseMeta($meta)
{
$fields = [];
foreach ($meta as $key => $value) {
$fields[] = [
'title' => $key,
'value' => $value,
];
}
return $fields;
}
}

0 comments on commit af5f44e

Please sign in to comment.