|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace ProcessMaker\Notifications; |
| 4 | + |
| 5 | +use Carbon\Carbon; |
| 6 | +use Illuminate\Bus\Queueable; |
| 7 | +use Illuminate\Notifications\Messages\BroadcastMessage; |
| 8 | +use Illuminate\Notifications\Messages\MailMessage; |
| 9 | +use Illuminate\Notifications\Notification; |
| 10 | +use ProcessMaker\Models\ProcessRequest as Instance; |
| 11 | +use ProcessMaker\Nayra\Contracts\Engine\ExecutionInstanceInterface; |
| 12 | + |
| 13 | +class SassCompiledNotification extends Notification |
| 14 | +{ |
| 15 | + use Queueable; |
| 16 | + |
| 17 | + private $processUid; |
| 18 | + private $processName; |
| 19 | + private $instanceUid; |
| 20 | + |
| 21 | + /** |
| 22 | + * Create a new notification instance. |
| 23 | + * |
| 24 | + * @return void |
| 25 | + */ |
| 26 | + public function __construct() |
| 27 | + { |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Get the notification's delivery channels. |
| 32 | + * |
| 33 | + * @param mixed $notifiable |
| 34 | + * @return array |
| 35 | + */ |
| 36 | + public function via($notifiable) |
| 37 | + { |
| 38 | + return ['broadcast', 'database']; |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Get the mail representation of the notification. |
| 43 | + * |
| 44 | + * @param mixed $notifiable |
| 45 | + * @return \Illuminate\Notifications\Messages\MailMessage |
| 46 | + */ |
| 47 | + public function toMail($notifiable) |
| 48 | + { |
| 49 | + return (new MailMessage) |
| 50 | + ->line('The introduction to the notification.') |
| 51 | + ->action('Notification Action', url('/')) |
| 52 | + ->line('Thank you for using our application!'); |
| 53 | + } |
| 54 | + |
| 55 | + public function toDatabase($notifiable) |
| 56 | + { |
| 57 | + return $this->toArray($notifiable); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Get the array representation of the notification. |
| 62 | + * |
| 63 | + * @param mixed $notifiable |
| 64 | + * @return array |
| 65 | + */ |
| 66 | + public function toArray($notifiable) |
| 67 | + { |
| 68 | + return [ |
| 69 | + 'type' => 'SASS_COMPILE_COMPLETED', |
| 70 | + 'name' => 'Sass compile completed', |
| 71 | + 'dateTime' => Carbon::today()->toIso8601String(), |
| 72 | + 'uid' => 1, |
| 73 | + 'request_id' => 1, |
| 74 | + 'url' => 'http://test.com' |
| 75 | + ]; |
| 76 | + } |
| 77 | + |
| 78 | + public function toBroadcast($notifiable) |
| 79 | + { |
| 80 | + return new BroadcastMessage($this->toArray($notifiable)); |
| 81 | + } |
| 82 | + |
| 83 | +} |
0 commit comments