问题
I have a guitar lessons site where I want to notify users (guests or logged in) about new notifications in real or near real time. I followed this example:
https://blog.pusher.com/writing-realtime-apps-with-laravel-5-and-pusher
I have an event set up, I have pusher account, I have things working as described in the above link.
But... I would like to have the notifications show up the way notifications appear on a lot of other sites. Namely, where a small popup appears on bottom right corner of browser regardless of where user is scrolled on current page. Or maybe where a message bar would appear on top of browser regaardless of where user is scrolled. In any case, I can't find examples of 5.2 notifications in this manner. All I see are examples of using a message div in a blade file and having the div populated via the pusher code in the blade. So I imagine to do do what I want is similar in spirit, just requiring some extra front end steps that are not clear to me yet.
Tips, examples appreciated!
Thanks
回答1:
Well you can use a common laravel blade file (with pusher code) and inherit that file in all blade templates. Now using jquery growl (http://ksylvest.github.io/jquery-growl/) or alert box of your choice you can show the popups on any page you want.
来源:https://stackoverflow.com/questions/45432395/laravel-5-2-popup-user-notifications-in-browser-examples-tips