Пример #1
0
 /**
  * Sends a push message
  *
  * @param string $title
  * @param string $message
  * @param Collection $users
  */
 public function send($title, $message, $users)
 {
     if ($users->count() == 0) {
         PastPush::create(['title' => $title, 'message' => $message]);
     }
     foreach ($users->chunk($this->batchSize) as $userBatch) {
         $registrationIds = $this->getRegistrationIds($userBatch);
         $response = $this->sendNotifications($title, $message, $registrationIds);
         $this->logPushNotification($title, $message, $response, $userBatch);
     }
 }