Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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);
 }