Commit 8077b082 authored by Sean O'Donnell's avatar Sean O'Donnell

Attemtping notifications on processes complete

parent 6ac63081
......@@ -65,6 +65,7 @@ class ProcessProcesses implements ShouldQueue
ProcessActivity::dispatch($activity->id);
}
}
$processes->notify(new ProcessesProcessed($processes));
}
......
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class ProcessesProcessed extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
public function toSlack($notifiable)
{
return (new SlackMessage)
->from('Production')
->to('#notify-processes')
->content('Latest process list from X has been processed');
}
}
......@@ -2,10 +2,12 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class Processes extends Model
{
use Notifiable;
/**
* The database table used by the model.
......@@ -15,6 +17,12 @@ class Processes extends Model
protected $table = 'processes';
public function routeNotificationForSlack($notification)
{
return 'https://hooks.slack.com/services/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';
}
/**
* The attributes that are mass assignable.
*
......@@ -27,7 +35,7 @@ class Processes extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user ()
public function user()
{
return $this->belongsTo('App\User');
}
......
......@@ -14,6 +14,11 @@ class UserFollow extends Model
*/
protected $table = 'user_follow';
public function routeNotificationForSlack($notification)
{
//return 'https://hooks.slack.com/services/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';
}
/**
* The attributes that are mass assignable.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment