PHP code example of laravel-notification-channels / ionic-push-notifications

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

    

laravel-notification-channels / ionic-push-notifications example snippets


// config/services.php
'ionicpush' => [
    'key' => env('IONIC_PUSH_API_KEY'),
]

use NotificationChannels\IonicPushNotifications\IonicPushChannel;
use NotificationChannels\IonicPushNotifications\IonicPushMessage;
use Illuminate\Notifications\Notification;

class FriendRequest extends Notification
{
    public function via($notifiable)
    {
        return [IonicPushChannel::class];
    }

    public function toIonicPush($notifiable)
    {
        return IonicPushMessage::create('my-security-profile')
            ->title('Your title')
            ->message('Your message')
            ->sound('ping.aiff')
            ->payload(['foo' => 'bar']);
    }
}

use NotificationChannels\IonicPushNotifications\IonicPushChannel;
use NotificationChannels\IonicPushNotifications\IonicPushMessage;
use Illuminate\Notifications\Notification;

class FriendRequest extends Notification
{
    public function via($notifiable)
    {
        return [IonicPushChannel::class];
    }

    public function toIonicPush($notifiable)
    {
        return IonicPushMessage::create('my-security-profile')
            ->iosMessage('Your iOS message')
            ->androidMessage('Your Android message')
            ->iosSound('ping.aiff')
            ->androidSound('ping.aiff');
    }
}

public function routeNotificationForIonicPush()
{
    return $this->device_token;
}

public function routeNotificationForIonicPush()
{
    return $this->device_tokens;
}