Saltar al contenido

Ejemplo de código de tutorial de notificación push de Laravel

Basta ya de buscar por todo internet ya que estás al sitio justo, tenemos la respuesta que necesitas pero sin problema.

Ejemplo 1: notificación de laravel

php artisan make:notification InvoicePaid

Ejemplo 2: crear laravel de notificación

php artisan make:notification notificationName

Ejemplo 3: notificaciones de empujador de laravel

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Demo Application</title><link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="/css/bootstrap-notifications.min.css"><!--[if lt IE9]><script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--></head><body><nav class="navbar navbar-inverse"><div class="container-fluid"><div class="navbar-header"><button type="button"class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-9" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="#">Demo App</a></div><div class="collapse navbar-collapse"><ul class="nav navbar-nav"><li class="dropdown dropdown-notifications"><a href="#notifications-panel"class="dropdown-toggle" data-toggle="dropdown"><i data-count="0"class="glyphicon glyphicon-bell notification-icon"></i></a><div class="dropdown-container"><div class="dropdown-toolbar"><div class="dropdown-toolbar-actions"><a href="#">Mark all as read</a></div><h3 class="dropdown-toolbar-title">Notifications (<span class="notif-count">0</span>)</h3></div><ul class="dropdown-menu"></ul><div class="dropdown-footer text-center"><a href="#">View All</a></div></div></li><li><a href="#">Timeline</a></li><li><a href="#">Friends</a></li></ul></div></div></nav><script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script><script src="//js.pusher.com/3.1/pusher.min.js"></script><script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><script type="text/javascript">var notificationsWrapper   = $('.dropdown-notifications');var notificationsToggle    = notificationsWrapper.find('a[data-toggle]');var notificationsCountElem = notificationsToggle.find('i[data-count]');var notificationsCount     =parseInt(notificationsCountElem.data('count'));var notifications          = notificationsWrapper.find('ul.dropdown-menu');if(notificationsCount <=0)
        notificationsWrapper.hide();// Enable pusher logging - don't include this in production// Pusher.logToConsole = true;var pusher =newPusher('API_KEY_HERE',encrypted:true);// Subscribe to the channel we specified in our Laravel Eventvar channel = pusher.subscribe('status-liked');// Bind a function to a Event (the full Laravel class)
      channel.bind('App\Events\StatusLiked',function(data)var existingNotifications = notifications.html();var avatar = Math.floor(Math.random()*(71-20+1))+20;var newNotificationHtml =`
          
  • +avatar+`.png" class="img-circle" alt="50x50" style="width: 50px; height: 50px;">
    `+data.message+`
    about a minute ago
  • `; notifications.html(newNotificationHtml + existingNotifications); notificationsCount +=1; notificationsCountElem.attr('data-count', notificationsCount); notificationsWrapper.find('.notif-count').text(notificationsCount); notificationsWrapper.show(););</script></body></html>

    Nos puedes reafirmar nuestro trabajo fijando un comentario o valorándolo te damos la bienvenida.

    ¡Haz clic para puntuar esta entrada!
    (Votos: 0 Promedio: 0)



    Utiliza Nuestro Buscador

    Deja una respuesta

    Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *