$notification = new \Bnb\PushNotifications\Notification('Hello World !', 'This is a test message');
$notification->metadata('custom-id', 1234);
$notification->push(\Bnb\PushNotifications\Device::gcm('test-token')->badge(3)->metadata('device-key','demoGcm'));
$notification->push(\Bnb\PushNotifications\Device::apns('test-token')->badge(2)->metadata('device-key','demoApns'));
$results = $notification->send();
// $results['errors'] // Contains the list of failed devices
// $results['updates'] // Contains the list of updated token devices (GCM)
// $results['payloads'] // Contains the messages payloads (APNs only) if config('push.payloads') is set to true
foreach($results['errors'] as $data) {
DbDevice::where('token', $data->token)
->delete();
}
foreach($results['updates'] as $data) {
DbDevice::where('token', $data['device']->token)
->update(['token' => $data['token']]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.