3

我正在使用该库:https ://github.com/davibennun/laravel-push-notification

我正在尝试转换这个(100% 工作)示例:

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

对于这样的事情:

$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)

我试过这个:

App.php(外观PushNotification)中 - 请参阅: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;
}

现在,如果我的队列提供程序是,我的方法不起作用Iron- 但是,如果我的队列sync不是那么有效,它就可以完美地工作。

第一个提供的示例有效,但不如我希望完成同样事情的方式那么漂亮。

4

0 回答 0