<?php require_once 'vendor/autoload.php'; Pushpad\Pushpad::$auth_token = '3f31ce907b0008fbde64d2f21399b9c7'; Pushpad\Pushpad::$project_id = 1211; ?> <div class="navbar-fixed"> <header id="header" class=""> <nav> <div class="nav-wrapper "> <a href="{{ url('/') }}" class="brand-logo center"><img id="brand-logo" src="{{asset('images/logo-completo.png')}}" width="120"></a> <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="fa fa-bars"></i></a> <ul class="right hide-on-med-and-down"> @if(Auth::check()) <li class="tooltipped dropdown-button" data-activates="dropdown2" data-delay="10" data-constrainwidth="false" data-beloworigin="true" data-alignment="right" data-tooltip="Notificaciones"> <a href="#!"><i style="font-size:18px" class="fa fa-bell badge1" data-badge="{{sizeof($notificaciones)}}"> </i> </a> </li> <li> <a class="dropdown-button valign-wrapper" href="#!" data-beloworigin="true" data-hover="true" data-activates="dropdown1" data-alignment="left"> @if (Auth::check() && Auth::user()->avatar != null) <img class="left avatar circle valign" src="{{Auth::user()->avatar}}" alt=""> @endif {{str_limit(Auth::user()->nombre,20,"...")}} <i class="right fa fa-caret-down"></i> </a> </li> @endif </ul> <ul class="center hide-on-med-and-down"> @if (!Auth::check())
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(); }
<a class="secondary-content badge" v-bind:class="{ 'blue lighten-2': notificacion.leido == '1'}" v-on:click="toggle(notificacion)" href="#!"> <i class="fa fa-lg" v-bind:class="{ 'fa-bell-o': notificacion.leido, 'fa-bell': !notificacion.leido}"></i> @{{notificacion.leido ? 'Marcar como no leido' : 'Marcar como leido'}} </a> <p> <b>@{{notificacion.titulo}}</b> | @{{ notificacion.mensaje }} <br> <i class="right">@{{ notificacion.created_at | fromNow | capitaiize }}</i> </p> </li> </ul> <div v-if="!notificaciones.length" class="no-content center fadeinleft"> <img src="{{asset('images/logo-happy.png')}}" alt="Sin Notificaciones" style="width:30%; -webkit-filter: grayscale(100%); filter: grayscale(100%);" /> <h3 class="grey-text">No tienes notificaciones</h3> </div> {{$notificaciones->links()}} <a class="btn btn-link btn-large right" href="<?php echo Pushpad\Pushpad::path_for(Auth::user()->id); ?> ">Suscribirse a notificaciones</a> </div> <script src="{{asset('js/vue.min.js')}}"></script> <script src="{{asset('js/moment.min.js')}}"></script> <script> moment.locale("es"); $.ajaxSetup({ headers: { 'Auth-Token': "{{ Crypt::encrypt(Auth::user()->id) }}" } }); var Vue = new Vue({ el: '#notificaciones',