|
|
@@ -0,0 +1,43 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Notifications;
|
|
|
+
|
|
|
+use Illuminate\Bus\Queueable;
|
|
|
+use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
+use Illuminate\Notifications\Messages\MailMessage;
|
|
|
+use Illuminate\Notifications\Notification;
|
|
|
+
|
|
|
+class FireBaseNotification extends Notification
|
|
|
+{
|
|
|
+ use Queueable;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create a new notification instance.
|
|
|
+ */
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the notification's delivery channels.
|
|
|
+ *
|
|
|
+ * @return array<int, string>
|
|
|
+ */
|
|
|
+ public function via(object $notifiable): array
|
|
|
+ {
|
|
|
+ return ['fcm'];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function toFcm(object $notifiable): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'to' => $notifiable->token_fcm,
|
|
|
+ 'notification' => [
|
|
|
+ 'title' => 'Notification Title',
|
|
|
+ 'body' => 'Notification Body',
|
|
|
+ 'image' => '', // Optional image URL
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+}
|