PHP code example of mblsolutions / paypoint-notification

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

    

mblsolutions / paypoint-notification example snippets


\MBLSolutions\Notification\NotificationServiceProvider::class,

Copy the package configuration to your local config directory.

'template' => [
        'default_id' => env('TEMPLATE_ID','xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx1'),
    ],

class SendEmail extends Notification implements ShouldQueue
{
    //... construct method

    public function toMail($notifiable)
    {
        return (new PayPointMailMessage(
                    //Change the template id if not default
                    config('notification.template.default_id'),
                    //Request Body
                    [   
                        'CallbackUrl' => '',
                        'Model' =>
                            [
                            'NotificationModel' =>
                                [
                                    'Recipients' =>
                                    [
                                        [
                                            'Name' => 'Test Customer',
                                            'Email' => '[email protected]'
                                        ]
                                    ],
                                    /* .. */
                                ]
                            ]                 
                        ]
                ));
    }
}

class SendEmail extends Notification implements ShouldQueue
{
    //... construct method

    public function toMail($notifiable)
    {
        return (new PayPointMailMessage(/* .. */))
                ->withUser($notifiable);
    }
}

'template' => [
        //Optional validation array with template id as key
        //The rule depends on what is the matched validation field in array from the above example of notification setup. e.g. $data
        'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx1' => [
            'validation_rule' => [
                'Model.NotificationModel.Recipients.*.Name' => ['
bash
php composer 
bash
php artisan vendor:publish --tag=notification-config
bash
php artisan paypoint-notification:database:table
`bash
php artisan migrate