PHP code example of chitranu / textlocal-laravel-notification-channel

1. Go to this page and download the library: Download chitranu/textlocal-laravel-notification-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/ */

    

chitranu / textlocal-laravel-notification-channel example snippets




return [

    // ...

    'textlocal' => [
        'key' => env('TEXTLOCAL_KEY'),
        'sender' => env('TEXTLOCAL_SENDER'),
    ],

];



use NotificationChannels\Textlocal\TextlocalChannel;
use NotificationChannels\Textlocal\TextlocalMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TextlocalChannel::class];
    }

    public function toSms($notifiable)
    {
        // OR explicitly return a TextlocalMessage object passing the message body:
        return new TextlocalMessage("Your {$notifiable->service} account was approved!");
    }
}



use Illuminate\Notifications\Notifiable;

class SomeModel {
    use Notifiable;

    public function routeNotificationForTextlocal($notification)
    {
        return '+1234567890';
    }
}