PHP code example of asantibanez / laravel-subscribable-notifications

1. Go to this page and download the library: Download asantibanez/laravel-subscribable-notifications 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/ */

    

asantibanez / laravel-subscribable-notifications example snippets


Notification::send([$user1, $user2, $user3], new OrderShipped($order));

// or 
$notification = new OrderShipped($order);

$user1->notify($notification);
$user2->notify($notification);
$user3->notify($notification);

OrderShipped::dispatch($order);

class SalesOrderApprovedNotification extends Notification implements SubscribableNotification
{
    use DispatchesToSubscribers;

    public static function subscribableNotificationType(): string
    {
        return 'sales-order.approved';
    }
    
    // notification implementation here
}