Closed geoidesic closed 1 month ago
CloudMessage::withTarget()
is a static constructor and meant to be used to instantiate a new message with a target as starting point. You should use the withChangedTarget()
method.
$message = CloudMessage::new()
->withNotification($notification)
->withData(['story_id' => 'story_1234'])
->withChangedTarget(MessageTarget::TOKEN, $token);
// or
$message = CloudMessage::withTarget(MessageTarget::TOKEN, $token)
->withNotification($notification)
->withData(['story_id' => 'story_1234']);
The method names are not the best, but that's the price for backward compatibility 😅
Describe the bug
Notification::create() works but when passing that into CloudMessage->withNotification(), the result is NULL
Installed packages
PHP version and extensions
Steps to reproduce the issue.
Error message/Stack trace