PHP code example of nextgen-tech / laravel-multiinfo

1. Go to this page and download the library: Download nextgen-tech/laravel-multiinfo 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/ */

    

nextgen-tech / laravel-multiinfo example snippets


// app/Models/User.php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;

class User extends Model
{
    use Notifiable;

    ...

    public function routeNotificationForMultiinfo(?Notification $notification): string
    {
        return $this->phone;
    }

    ...
}

// app/Notifications/ExampleNotification.php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use NGT\Laravel\MultiInfo\MultiInfoMessage;

class ExampleNotification extends Notification
{
    public function via($notifiable): array
    {
        return ['multiinfo'];
    }

    public function toMultIinfo($notifiable): MultiInfoMessage
    {
        return (new MultiInfoMessage())
            ->content('test message');
    }
}

use NGT\MultiInfo\Handler;
use NGT\MultiInfo\Requests\SendSmsRequest;

$handler = app(Handler::class);

$request = app(SendSmsRequest::class)
    ->setDestination('123123123')
    ->setContent('test message');

/** @var \NGT\MultiInfo\Responses\SendSmsResponse */
$response = $handler->handle($request);