<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rezadaulay / filament-whatsapp-notification example snippets
use Rezadaulay\FilamentWhatsappNotification\FilamentWhatsappNotificationPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentWhatsappNotificationPlugin::make(),
]);
}
use Illuminate\Notifications\Notifiable;
class User
{
use Notifiable;
public function routeNotificationForWhatsapp(): string
{
return $this->phone_number;
}
}
use Illuminate\Notifications\Notification;
use Rezadaulay\FilamentWhatsappNotification\Messages\WhatsappMessage;
class OrderPaidWhatsappNotification extends Notification
{
public function via(object $notifiable): array
{
return ['whatsapp'];
}
public function toWhatsapp(object $notifiable): WhatsappMessage
{
return WhatsappMessage::make()
->content("Your order #{$this->order->number} has been paid.")
->payload([
'order_id' => $this->order->id,
'type' => 'order-paid',
]);
}
}
public function toWhatsapp(object $notifiable): WhatsappMessage
{
return WhatsappMessage::make()
->to('081234567890')
->countryCode('62')
->content('Hello from WhatsApp')
->deduplicationKey('order-123-paid');
}