for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Illuminate\Notifications\Messages;
use Closure;
class SlackMessage
{
/**
* The "level" of the notification (info, success, error).
*
* @var string
*/
public $level = 'info';
* The text content of the message.
public $content;
* The message's attachments.
* @var array
public $attachments = [];
* Indicate that the notification gives information about a successful operation.
* @return $this
public function success()
$this->level = 'success';
return $this;
}
* Indicate that the notification gives information about an error.
public function error()
$this->level = 'error';
* Set the content of the Slack message.
* @param string $content
public function content($content)
$this->content = $content;
* Define an attachment for the message.
* @param \Closure $callback
public function attachment(Closure $callback)
$this->attachments[] = $attachment = new SlackAttachment;
$callback($attachment);
* Get the color for the message.
* @return string
public function color()
switch ($this->level) {
case 'success':
return '#7CD197';
case 'error':
return '#F35A00';