PHP code example of laravel-notification-channels / pushwoosh

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

    

laravel-notification-channels / pushwoosh example snippets


'pushwoosh' => [
    'application' => env('PUSHWOOSH_APP_CODE'),
    'token' => env('PUSHWOOSH_TOKEN'),
],

class Customer extends Model
{
    use Notifiable;
    
    public function routeNotificationForPushwoosh()
    {
        // In this example 'device_id' is a token previously
        // retrieved from Pushwoosh using one of their SDKs
        return (new PushwooshRecipient)->device($this->device_id);
    }
}

class WishlistItemOnSale extends Notification
{
    public function via($notifiable)
    {
        return ['pushwoosh'];
    }
    
    public function toPushwoosh($notifiable)
    {
        return (new PushwooshMessage)
            ->content('Your wishlist item ' . $this->product->name . ' is on sale, get it now!')
            ->url(route('products.show', $this->product))
            ->deliverAt(Carbon::now()->addMinutes(10));
    }
}

$customer->notify(new WishlistItemOnSale($product));

Notification::send($customers, new WishlistItemOnSale($product));

Event::listen(
    NotificationChannels\Pushwoosh\Events\UnknownDevices::class,
    function ($event) {
        // Handle the event
    }
);