Laravel queues and push

I am using the library: https://github.com/davibennun/laravel-push-notification

I am trying to convert this (100% working) example:

Queue::push(function() {
    $push = PushNotification::app('SomeApp')
                    ->to('some_recipient')
                    ->send('Hello World, im a push message');
});

      

Something like that:

$push = PushNotification::app('SomeApp')
                ->to('some_recipient')
                ->queue('Hello World, im a push message'); // notice ->send is switched out to ->queue (like the Mail::queue method)

      

I've tried this:

In App.php

(facade for PushNotification

) - see https://github.com/davibennun/laravel-push-notification/tree/master/src/Davibennun/LaravelPushNotification .

public function queue($message, $options = array()) {

    Queue::push(function($job) use($message, $options) {
        $this->send($message, $options);

        $job->delete();
    });

    return $this;
}

      

Now my method doesn't work if my queue provider Iron

is - it does, however, work fine if my queue is sync

n't efficient.

The first example given works, but not as good as I want to accomplish the same thing.

+3


source to share





All Articles