use Illuminate\Notifications\Notification;
use NotificationChannels\SmsApi\SmsApiChannel;
use NotificationChannels\SmsApi\SmsApiMessage;
class InvoicePaid extends Notification
{
public function via(object $notifiable): array
{
return [SmsApiChannel::class];
}
public function toSmsApi(object $notifiable): SmsApiMessage
{
return SmsApiMessage::create('Faktura została opłacona.');
}
}
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
}
use Illuminate\Notifications\Notification;
public function routeNotificationForSmsApi(?Notification $notification = null): string
{
return $this->phone;
}
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForSmsApi(?Notification $notification = null): string
{
return $this->phone;
}
}
return SmsApiMessage::create('Faktura została opłacona.')
->to('+48123123123')
->from('MyBrand');
return SmsApiMessage::create('Faktura została opłacona.')
->toMany([
'+48123123123',
'+48999111222',
])
->from('MyBrand');
use Illuminate\Notifications\Notification;
public function routeNotificationForSmsApi(?Notification $notification = null): array
{
return [
'+48123123123',
'+48999111222',
];
}
use Illuminate\Notifications\Notification;
use NotificationChannels\SmsApi\SmsApiChannel;
use NotificationChannels\SmsApi\SmsApiMessage;
class InvoiceWithAttachment extends Notification
{
public function via(object $notifiable): array
{
return [SmsApiChannel::class];
}
public function toSmsApi(object $notifiable): SmsApiMessage
{
return SmsApiMessage::create()
->mms('Invoice 2026/04', '<smil><body><par><text src="invoice.txt"/></par></body></smil>')
->set('files[invoice.txt]', base64_encode('Invoice content'));
}
}