PHP code example of avto-dev / smspilot-notifications-laravel

1. Go to this page and download the library: Download avto-dev/smspilot-notifications-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/ */

    

avto-dev / smspilot-notifications-laravel example snippets


'providers' => [
    // ...
    AvtoDev\SmsPilotNotifications\SmsPilotServiceProvider::class,
],



return [

    // ...

    'sms-pilot' => [
        'key'         => env('SMS_PILOT_API_KEY'),
        'sender_name' => env('SMS_PILOT_SENDER_NAME'),
    ],

];



use AvtoDev\SmsPilotNotifications\SmsPilotChannel;
use AvtoDev\SmsPilotNotifications\Messages\SmsPilotMessage;

class Notification extends \Illuminate\Notifications\Notification
{
    /**
     * Get the notification channels.
     *
     * @param mixed $notifiable
     *
     * @return array|string
     */
    public function via($notifiable)
    {
        return [SmsPilotChannel::class];
    }

    /**
     * Get the SMS Pilot Message representation of the notification.
     *
     * @param mixed $notifiable
     *
     * @return SmsPilotMessage
     */
    public function toSmsPilot($notifiable): SmsPilotMessage
    {
        return (new SmsPilotMessage)
            ->content('Some SMS notification message');
    }
}



class Notifiable
{
    use \Illuminate\Notifications\Notifiable;

    /**
     * Get route for 'SMS Pilot' notification.
     *
     * @param mixed $notifiable
     *
     * @return string
     */
    public function routeNotificationForSmsPilot($notifiable): string
    {
        return '71112223344';
    }
}