PHP code example of dmitrakovich / smstraffic-for-laravel

1. Go to this page and download the library: Download dmitrakovich/smstraffic-for-laravel 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/ */

    

dmitrakovich / smstraffic-for-laravel example snippets


/**
 * Get the SmsTraffic / SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \Illuminate\Notifications\Messages\SmsTrafficMessage
 */
public function toSmsTraffic($notifiable)
{
    return (new SmsTrafficMessage)
                ->content('Your SMS message content');
}

/**
 * Get the SmsTraffic / SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \Illuminate\Notifications\Messages\SmsTrafficMessage
 */
public function toSmsTraffic($notifiable)
{
    return (new SmsTrafficMessage)
                ->content('Your unicode message')
                ->route('whatsapp(180)-sms');
}

/**
 * Get the SmsTraffic / SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \Illuminate\Notifications\Messages\SmsTrafficMessage
 */
public function toSmsTraffic($notifiable)
{
    return (new SmsTrafficMessage)
                ->content('Your SMS message content')
                ->from('15554443333');
}



namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the SmsTraffic channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForSmsTraffic($notification)
    {
        return $this->phone_number;
    }
}

SmsTraffic::send($phones, $message);