diff --git a/app/Jobs/SendSimpleNotificationJob.php b/app/Jobs/SendSimpleNotificationJob.php new file mode 100644 index 000000000..78bc88baf --- /dev/null +++ b/app/Jobs/SendSimpleNotificationJob.php @@ -0,0 +1,37 @@ +user = $user; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $this->user->notify(new SimpleNotification()); + } +} diff --git a/app/Notifications/SimpleNotification.php b/app/Notifications/SimpleNotification.php new file mode 100644 index 000000000..548182738 --- /dev/null +++ b/app/Notifications/SimpleNotification.php @@ -0,0 +1,61 @@ +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 [ + // + ]; + } +} diff --git a/tests/Unit/SendSimpleNotificationJobTest.php b/tests/Unit/SendSimpleNotificationJobTest.php new file mode 100644 index 000000000..866c8ddd6 --- /dev/null +++ b/tests/Unit/SendSimpleNotificationJobTest.php @@ -0,0 +1,30 @@ + 'foobar@example.com', 'password' => 'asdf']); + $job = new SendSimpleNotificationJob($user); + $job->handle(); + Notification::assertSentTo($user, SimpleNotification::class); + } +} diff --git a/tests/Unit/SimpleNotificationTest.php b/tests/Unit/SimpleNotificationTest.php new file mode 100644 index 000000000..4c386f0a6 --- /dev/null +++ b/tests/Unit/SimpleNotificationTest.php @@ -0,0 +1,28 @@ + 'foobar@example.com', 'password' => 'asdf']); + $user->notify($notification); + Notification::assertSentTo($user, SimpleNotification::class); + } +}