PHP code example of salamwaddah / laravel-smsglobal-notifications-channel

1. Go to this page and download the library: Download salamwaddah/laravel-smsglobal-notifications-channel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

salamwaddah / laravel-smsglobal-notifications-channel example snippets


use Illuminate\Notifications\Notification;
use SalamWaddah\SmsGlobal\SmsGlobalChannel;
use SalamWaddah\SmsGlobal\SmsGlobalMessage;

class OrderPaid extends Notification
{

    public function via($notifiable): array
    {
        return [
            SmsGlobalChannel::class,
        ];
    }

    public function toSmsGlobal($notifiable): SmsGlobalMessage
    {
        $message = 'Order paid, Thank you for your business!';

        $smsGlobal = new SmsGlobalMessage();

        return $smsGlobal->to($notifiable->phone)->content($message);
    }
}

Notification::send(
    '+971555555555',
    new OrderPaid($order)
);

public function toSmsGlobal(string $phoneNumber): SmsGlobalMessage
{
    $message = 'Order paid, Thank you for your business!';

    $smsGlobal = new SmsGlobalMessage();

    return $smsGlobal->to($phoneNumber)->content($message);
}