public static function message_push_notification($device_token) { $error_code = ApiResponse::OK; $devices = PushNotification::DeviceCollection(array(PushNotification::Device($device_token, array('badge' => 5)))); $message = PushNotification::Message('This is message test', array('badge' => 1, 'actionLocKey' => 'Action button title!', 'locKey' => 'localized key', 'custom' => array('custom data' => array('we' => 'want', 'send to app')))); $data = PushNotification::app('YineLover')->to($devices)->send($message); return $data; }
public function entregado() { $envios = Envios::find(Input::get('id')); $usuario = UsuariosHD::where('username', '=', Input::get('username'))->first(); $pedido = Pedidos::where('id', '=', Input::get('id_pedido'))->first(); $usuario->estatus_u = 'ocupado'; $usuario->save(); $reg = Input::get('reg_id'); if ($reg != "") { $valor = PushNotification::Message('¡Tu pedido ha llegado!', array('valor' => 2, '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')))); PushNotification::app('Tasty')->to($reg)->send($valor); } $user = User::where('id', '=', $pedido->id_usuario)->first(); $envios->estatus = 'entregado'; $envios->save(); return Response::json('success'); }
public function startQueueMessage($devices, $data) { $deviceCollection = $this->generateDeviceCollection($devices); $devices = PushNotification::DeviceCollection($deviceCollection); $message = PushNotification::Message($data['message'], array('badge' => 1)); Queue::push(function ($job) use($devices, $data) { //PushNotification::app('appNameIOS') // ->to($devices) // ->send($message); $message = ''; foreach ($devices as $device) { $message .= 'sending message(' . $data['message'] . ') to ' . $device->token . ' : '; } File::append(app_path() . '/queue.txt', $message . PHP_EOL); $job->delete(); }); }
public function hogarPedidos() { $pedido = Pedidos::find(Input::get('idpedido')); $user = $usuario = User::where('id', '=', $pedido->id_usuario)->first(); $restaurante = Restaurantes::where('id', '=', $pedido->id_restaurante); $var = Auth::user()->id_restaurante; $validacion = hd::where('id_restaurante', '=', $var)->get(); if (Input::has('Confirmar')) { $pedido->estatus = 'sinPagar'; $pedido->save(); $envios = new Envios(); $envios->estatus = 'pendiente'; $envios->id_pedido = $pedido->id; $envios->coordenadas_accidente = 0; $envios->id_restaurante = $pedido->id_restaurante; $envios->save(); foreach ($validacion as $key2 => $info2) { if ($info2->decision == 0) { $reg = UsuariosHD::reg($var)->get(); if ($reg != "") { foreach ($reg as $key => $info) { $valor = PushNotification::Message('¡Envíos disponibles!', array('valor' => 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')))); PushNotification::app('HappyDelivery')->to($info->reg_id)->send($valor); } } } if ($info2->decision == 1) { $reg = UsuariosHD::reg2($var)->get(); if ($reg != "") { foreach ($reg as $key => $info) { $valor = PushNotification::Message('¡Envíos disponibles!', array('valor' => 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')))); PushNotification::app('HappyDelivery')->to($info->reg_id)->send($valor); } } } } return Redirect::to('/')->with('success', 'Orden Aceptada Con Exito'); } elseif (Input::has('Declinar')) { $pedido->estatus = 'declinada'; $pedido->save(); return Redirect::to('/')->with('success', 'Orden Cancelada Con Exito'); } }
public function created($model) { if (Config::get('var.push', false)) { $dispositivos = Dispositivo::active()->eventos()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $actions = []; $actions[0] = new stdClass(); $actions[0]->icon = 'eye'; $actions[0]->title = 'ver'; $actions[0]->callback = 'mycallback'; $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message($model->user->nombre . ' ha agregado un nuevo evento', ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', 'title' => 'Nueva Evento', "ledColor" => [0, 146, 234, 255], 'actions' => $actions]); $collection = PushNotification::app('android')->to($devices)->send($message); } }
public function push() { Notificacion::InsertarNotificacionesMasivas(Input::get('titulo'), Input::get('mensaje')); //Notificaciones en android $dispositivos = Dispositivo::active()->mensajes()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message(Input::get('mensaje'), ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', "ledColor" => [0, 146, 234, 255], 'title' => Input::get('titulo'), "style" => "inbox", "summaryText" => "Tienes %n% notificaciones", 'actions' => [["title" => "Abrir", "callback" => "abrir", "foreground" => false]]]); $collection = PushNotification::app('android')->to($devices)->send($message); // notificaciones en el navegador require_once 'vendor/autoload.php'; Pushpad\Pushpad::$auth_token = '3f31ce907b0008fbde64d2f21399b9c7'; Pushpad\Pushpad::$project_id = 1211; $notification = new Pushpad\Notification(array('body' => Input::get('mensaje', ''), 'title' => Input::get('titulo', 'Residencias Online'))); $notification->broadcast(['tags' => []]); Session::flash('success', 'Mensaje enviado'); return Redirect::back(); }
public function timevaloracion() { $reg = Input::get('reg_id'); if ($reg != "") { $valor = PushNotification::Message('¡Valora tu pedido!', array('valor' => 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')))); PushNotification::app('Tasty')->to($reg)->send($valor); } return Response::json('1'); }
public function cargarCobros() { $mes = Input::get('mes'); $año = Input::get('año'); foreach (Residencias::all() as $residencia) { $solvencia = Solvencia::firstorNew(['mes' => $mes, 'año' => $año, 'residencia_id' => $residencia->id]); $solvencia->estado = 3; $solvencia->monto = getdeuda($residencia->id, $mes, $año); $solvencia->save(); } Notificacion::InsertarNotificacionesMasivas("Nuevo Recibo Agregado", "Se ha agregado el recibo de " . getMeses()[$mes] . $año); Session::flash('success', "Cobros cargados Correctamente"); if (Config::get('var.push', false)) { $dispositivos = Dispositivo::active()->mensajes()->get(); $disp = []; foreach ($dispositivos as $dispositivo) { $disp[] = PushNotification::Device($dispositivo->token); } $devices = PushNotification::DeviceCollection($disp); $message = PushNotification::Message("Se ha agregado el recibo de " . getMeses()[$mes] . $año, ['badge' => 1, 'image' => 'www/logo.png', 'soundname' => 'alert', "ledColor" => [0, 146, 234, 255], 'title' => 'Nueva Recibo Agregado']); $collection = PushNotification::app('android')->to($devices)->send($message); } return Redirect::to('admin/Finanzas/gestion?mes=' . $mes . '&año=' . $año); }
public static function sendPnsToIOSDevices($device_tokens, $message, $data = null) { try { $i_devices_collection = array(); foreach ($device_tokens as $device_token) { $i_devices_collection[] = \PushNotification::Device($device_token); } if ($i_devices_collection) { $i_devices_collection = \PushNotification::DeviceCollection($i_devices_collection); if ($data && is_array($data)) { $message = \PushNotification::Message($message, $data); } \PushNotification::app(self::$pns_ios_app_name)->to($i_devices_collection)->send($message); } return true; } catch (Exception $e) { return false; } }