Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.
MIT License
478 stars 159 forks source link

Not able to send push notification when using it in notification channel #51

Closed ireshparmar closed 6 years ago

ireshparmar commented 6 years ago

Bellow is my sample notification class. In that i am sending push notification using Apn Channel. But I don't get any response. When i try to dd() in toApn method at that time i get null.

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Edujugon\PushNotification\Channels\ApnChannel; use Edujugon\PushNotification\Messages\PushMessage; class SamplePushNotification extends Notification Implements ShouldQueue { use Queueable;

/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct()
{
    //
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{

    return [ApnChannel::class];
}

public function toApn($notifiable)
{

    return new PushMessage('Hello world');
}

}

Edujugon commented 6 years ago

Hi @ireshparmar ,

There is no sample where I can check... are you sure you pasted/attached?

Edujugon commented 6 years ago

Hi @ireshparmar , I'm closing this issue since there is no response. Please fell free to reopen it anytime.