Closed KoIIIeY closed 3 years ago
Now I understand what you want to achieve :) I think it is better to add an ability to add custom value in the Alert class, and not change the payload custom value method.
Now I understand what you want to achieve :) I think it is better to add an ability to add custom value in the Alert class, and not change the payload custom value method.
The problem is that I also need to change the laravel notification channels in order for it to work :) In theory, it will be enough for me to at least insert data directly as a string, given that no one has noticed this problem before, then nothing will break for anyone.
Ok, I done all changes that we both wants.
Added array as value for alert in setAlert, so we doesnt need always use JSON serialize and deserialize for settings. Your setCustom returned to original and my new method addCustomValue added.
Plz check and merge
@edamov , can you check? My project needs that changes :)
And I already created new pull request to Laravel notification channels https://github.com/laravel-notification-channels/apn/pull/122
Thanks :)
Fix for able to do like this:
public function toApnVoip($notifiable) { return ApnVoipMessage::create() ->body(json_encode($this->card)) ->custom('aps', ['alert' => ['incoming_caller_id' => $this->card->patient->user_id, 'incoming_caller_name' => $this->card->patient->fullName, 'uuid' => \uniqid()]]) ->badge(1); }