I'm trying to rewrite some code in Laravel in order to make it a job and for that I'm doing the following:
$subscriptions->each(function ($sub) use ($payload) {
$channel = $this;
// new code
dispatch(new SendOnePushNotification($channel, $sub, $payload));
// old code below
/*$this->webPush->sendNotification(
$sub->endpoint,
$payload,
$sub->public_key,
$sub->auth_token
);*/
});
The problem seems to be passing $this to the SendOnePushNotification constructor.
My guess is that I could rewrite this somehow but I'm unsure how to begin. Any advice?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire