PHP code example of samcbdev / mail-notifier

1. Go to this page and download the library: Download samcbdev/mail-notifier 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/ */

    

samcbdev / mail-notifier example snippets

sh
    php artisan vendor:publish --tag="mail-notifier"
    
sh
    php artisan migrate
    
sh
    $filter = [
        'custom_fields->comp_id' => 1,
    ];
    Mailer::filterCondition($filter, true)->get(); // true returns first matching record
    
sh
    $data = [
        'template_unique_id' => 'FP',
        'custom_fields' => [ // here custom field is json column
            'comp_id' => 1
        ],
        'title' => 'Title',
        'subject' => 'Subject',
        'content' => 'Content'
    ];

    $setUnique = ['template_unique_id', 'custom_fields->comp_id'];

    Mailer::storeData($setUnique, $data);
    
sh
    $data = [
        'template_unique_id' => 'FP',
        'custom_fields' => [
            'comp_id' => 1
        ],
        'title' => 'Title',
        'subject' => 'Subject',
        'content' => 'Content'
    ];

    $setUnique = ['template_unique_id', 'custom_fields->comp_id'];
    
    Mailer::editData(1, $setUnique, $data);
    
sh
    $filter = [
        'template_unique_id' => 'FP',
        'custom_fields->comp_id' => 1,
    ];
    Mailer::filterCondition($filter, true)->checkDynamicFields();
    
sh
php artisan queue:work