PHP code example of utyemma / laranotice

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

    

utyemma / laranotice example snippets


    use App\Mailable\ExampleMailable;

    //Send your first notification message
    (new ExampleMailable)->send($user, ['mail', 'database']);

    use Utyemma\LaraNotice\Notify;
    use App\Models\User;

    $users = User::all();

    //Send your first notification message
    Notify::subject('Your Notification Subject')
                ->greeting('Hello!')
                ->line('You have a new message.')
                ->line('Thank you for using our application!');
                ->send($users, ['mail', 'database']);

use Utyemma\LaraNotice\Notify;
use App\Models\User;

$recievers = ['[email protected]', '[email protected]'];

$data = [
    'name' => 'John Doe'
];

//Send your first notification message
(new Notify)->subject('Your Notification Subject', $data)
                ->greeting('Hello {{name}}')
                ->line('You have a new message.')
                ->line('Thank you for using our application!');
                ->mail($recievers);

    namespace App\Mailable;

    use Illuminate\Support\Facades\Blade;
    use Utyemma\LaraNotice\Notification;

    class ExampleMailable extends Notification {
        public function setResolver($content, $placeholders){
            return new Blade::render($content, $placeholders);
        }
    }

    namespace App\Resolvers;

    use Handlebars\Handlebars;

    class HandleBarsResolver {

        function __invoke($content, $placeholders){
            return (new Handlebars)->render($content, $placeholders);
        }

    }

    use App\Resolvers\HandleBarsResolver;

    return [
        'resolver' => HandleBarsResolver::class
    ];
bash
php artisan migrate

php artisan make:mailable ExampleMailable