File: /var/www/vhost/disk-apps/dev-telemedicina.teky.com.co/app/Http/Controllers/OneSignalController.php
<?php
namespace Telemedicina\Http\Controllers;
use Illuminate\Http\Request;
use OneSignal;
class OneSignalController extends Controller
{
/**
* * Envio de notificacion con destino absolutamente todos los usuarios registrados en el app de OneSignal
* @param $message - Mensaje a ser enviado
* @param $url - URL que redirecciona la notificacion
* @param $data - Datos en segundo plano enviados junto a la notificacion
* @param $buttons - Botones incluidos en la notificacion aplica con ciertas restricciones según version iOS y Android
* @param $schedule - Fecha y hora de programación de la notificacion formatos posibles:
* "Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)"
* "September 24th 2015, 2:00:00 pm UTC-07:00"
* "2015-09-24 14:00:00 GMT-0700"
* "Sept 24 2015 14:00:00 GMT-0700"
* "Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)"
* @param $typeTarget - U : USER D : DELIVERY
*/
public static function sendToAll($message, $url, $data, $buttons, $schedule, $typeTarget){
OneSignal::sendNotificationToAll($message, $url = $url, $data = $data, $buttons = $buttons, $schedule = $schedule);
}
/**
* * Envio de notificacion con destino a un usuario según su Player ID.
* @param $message - Mensaje a ser enviado
* @param $idOneSignal - Player ID asignado por la palataforma de OneSignal.
* @param $url - URL que redirecciona la notificacion
* @param $data - Datos en segundo plano enviados junto a la notificacion
* @param $buttons - Botones incluidos en la notificacion aplica con ciertas restricciones según version iOS y Android
* @param $schedule - Fecha y hora de programación de la notificacion formatos posibles:
*
* "Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)"
* "September 24th 2015, 2:00:00 pm UTC-07:00"
* "2015-09-24 14:00:00 GMT-0700"
* "Sept 24 2015 14:00:00 GMT-0700"
* "Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)"
* @param $typeTarget - U : USER D : DELIVERY
*/
public static function sendToUser($message, $idOneSignal, $url, $data, $buttons, $schedule, $typeTarget){
OneSignal::sendNotificationToUser($message, $idOneSignal, $url = $url, $data = $data, $buttons = $buttons, $schedule = $schedule);
}
/**
* * Envio de notificacion con destino un segmento, el cual debe existir en la plataforma de OneSignal.
* @param $message - Mensaje a ser enviado
* @param $segment - Segmento, el cual debe estar creado en la plataforma de OneSignal.
* @param $url - URL que redirecciona la notificacion
* @param $data - Datos en segundo plano enviados junto a la notificacion
* @param $buttons - Botones incluidos en la notificacion aplica con ciertas restricciones según version iOS y Android
* @param $schedule - Fecha y hora de programación de la notificacion formatos posibles:
*
* "Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)"
* "September 24th 2015, 2:00:00 pm UTC-07:00"
* "2015-09-24 14:00:00 GMT-0700"
* "Sept 24 2015 14:00:00 GMT-0700"
* "Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)"
* @param $typeTarget - U : USER D : DELIVERY
*/
public static function sendToSegments($message, $segment, $url, $data, $buttons, $schedule, $typeTarget){
OneSignal::sendNotificationToSegment($message, $segment, $url = $url, $data = $data, $buttons = $buttons, $schedule = $schedule);
}
/**
* * Envio de notificacion con destino a las tags indicadas, las cuales deben existir en la plataforma de OneSignal.
* @param $message - Mensaje a ser enviado
* @param $tags - TAGS, etiquetas que deben estar marcadas en el usuario. Array ( ['key' => 'val_key1', 'relation' => '=', 'value' => 'val_value1' ], ['key' => 'val_key2', 'relation' => '=', 'value' => 'val_value2' ])
* @param $url - URL que redirecciona la notificacion
* @param $data - Datos en segundo plano enviados junto a la notificacion
* @param $buttons - Botones incluidos en la notificacion aplica con ciertas restricciones según version iOS y Android
* @param $schedule - Fecha y hora de programación de la notificacion formatos posibles:
*
* "Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)"
* "September 24th 2015, 2:00:00 pm UTC-07:00"
* "2015-09-24 14:00:00 GMT-0700"
* "Sept 24 2015 14:00:00 GMT-0700"
* "Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)"
* @param $typeTarget - U : USER D : DELIVERY
*/
public static function sendToTags($message, $tags, $url, $data, $buttons, $schedule, $typeTarget){
OneSignal::sendNotificationUsingTags($message, $tags, $url = $url, $data = $data, $buttons = $buttons, $schedule = $schedule);
}
}