V
V
Vladislav Dmitruk2017-03-05 12:55:10
Notifications
Vladislav Dmitruk, 2017-03-05 12:55:10

Is there a custom notifications module?

Hello.
Please tell me the extension for Laravel, which allows you to create notifications for the user, something like - You have 1 unread message, and so on ..
Thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Mokhirjon Naimov, 2017-03-05
@zvermafia

I know video lesson: Notifications: Database

V
Victor, 2017-03-06
@Levhav

In order not to ask permission from the user and deliver in real time, it is best to use web sockets.
Here is an example . But to work with websockets, you need a comet server. Since php is not effective for this. For example, you can use a saas comet server so that you don’t worry about setting up and installing it on your vps. Or open source cometserver so as not to depend on third-party resources.

S
Stanislav Pochepko, 2017-03-07
@DJZT

Create a model and a table with the structure
Notifications
-- id
-- user_id
-- message
-- subject
-- created_at
-- updated_at
Create a one-to-many relationship with User
If it's a header on the page (Although it doesn't matter, the main thing is to allocate a separate view for the notification widget) make a ComposerView (In the dock in the Blade section) for this view in which you get the current user and make a selection $user->notifications (You can add various conditions $user->notifications()->where('read', 0)-> get(), while changing the structure) and pass this collection to view. And then he makes a template to taste and go ahead.
This will only work on reboot.
If it is necessary in real-time, then it is more difficult and longer to write. Stack - socket.io + laravel notifications + vue.js

A
Andrew, 2017-03-05
@dasty

You need HTML 5 Notifications.
There is an article on habré https://habrahabr.ru/post/183630/

S
Sergey Sokolov, 2017-03-06
@sergiks

Since version 5.3, Laravel has a built-in mechanism for Notifications .
In 5.4 it is more developed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question