davibennun / laravel-push-notification

Laravel package to enable sending push notifications to devices
1.23k stars 259 forks source link

Understanding Feedback #180

Open santoshachari opened 7 years ago

santoshachari commented 7 years ago

Hi there! Thanks for the awesome plugin.

I've tried sending batch push notifications.

 $devices = PushNotification::DeviceCollection(array(
        PushNotification::Device('cc287bda96132dc8c4db6e61904e218a671db3554214a3b29dcde3521a1bb6d9', array('badge' => 5)),
        PushNotification::Device('42f1f765f4778afbb385561618c2917e2c46f681a2522ab52f7630e21836c27b', array('badge' => 1)),
        PushNotification::Device('f683403f3f622f5ba3bb27ae3d5fc3345a9476b40a4ec4a621a6d75f404abd30')
    ));

    $message = PushNotification::Message('Message Text 2',array(
        'badge' => 1,
        'sound' => 'example.aiff',

        'actionLocKey' => 'Action button title!',
        'locKey' => 'localized key',
        'locArgs' => array(
            'localized args',
            'localized args',
        ),
        'launchImage' => 'image.jpg',

        'custom' => array('custom data' => array(
            'we' => 'want', 'send to app'
        ))
    ));

    $collection = PushNotification::app('appNameIOS')
        ->to($devices)
        ->send($message);

// get response for each device push
    foreach ($collection->pushManager as $push) {
        $response[] = $push->getAdapter()->getResponse();

    }

    dd($response);

And here was the output:

array:1 [▼
  0 => Message {#365 ▼
    #id: 4
    #code: 8
  }
]

What is id, and code here? Thanks.