I am finding it very difficult to find any information on how to retrieve the count of all currently unread notifications of the current session user. Ideally i would just like to return a number via php to html of all unread notifications. What i would like to do is pool for notifications every minite or so and if there is a new one i would like to be alerted and the status updated. I have tried this via the array from getNotifications but no luck. Is counting the current unread notifications even possible ?????. Basically i am asking how current smartphones are getting the count and alerting users to when there is a new notification etc.
Any help is greatly appreciated
Thanks
Did you check that : http://developers.facebook.com/docs/reference/fql/notification/ ?
I guess you can check every minute the unread notification of a user, record them in the database, and if a new one appear (ie wasn't present in the previous request), you update the status of the user
Related
I have a page that displays all of the user's notifications. I want to highlight notifications that has not yet been read by the user.
However, when I use
$notifications = tap(auth()->user()->notifications)->markAsRead();
It automatically marks all the notifications as read and I am unable to tell the blade file which notifications are those that have already been read and which notifications are those that the user has not yet seen since he/she last visited the notifications page. Any help would be appreciated. Thanks!
You should just use unreadNotifications instead of notifications, therefore you'll mark them as read but you'll know that everyone of them was unread.
I am unable to determine if a notification has been read or not. I have checked the notifications table for ones that I have viewed, and the read_at value is null.
I have tried to access unread notifications with the following code:
return Auth::user()->unreadNotifications;
How does Laravel indicate a notification has been read and what are possible causes for the notifications table or model instances to not be updated?
I am looking for a solution to notify all the users for occurrence of X activity in the app.
I am not looking for notification by mail or sms. Because this specific notification would be send to all the users, which could be anywhere between 1000 to 25000 users. sending 1000s of mail or sms is waste of resources.
I want to notify users using something which goes noticed, that is they would read. for example: if the X activity has happened today. And Y user logins after 10 days he/she must be able to see the notification (I guess flash message wont work in this case).
What is the best and most efficient way possible? if notification using database is the way that I think. How can I create a single notification (single entry in database) and make sure all the users read that notification next time login? without creating 1000s of rows?
I think storing notifications in the database would be the way to go too.
If you add a many-to-many relationship between your User and Notification models, with a is_read flag on the relationship pivot table.
Then when a user reads the notification, you update the is_read flag to 1. Alternatively, if you don't need to keep the notification for that user, you could delete the relationship, thus reducing storage of obsolete records.
Edit
If every user will always see every notification, then you could store the last_login_at timestamp on your User model, which is updated each time a user logs in.
Then each time a user logs in, find all Notifications created since the last_login_at and show them to the user.
I am working on project in Opencart 2.0.1.1 version.
I want to show a sound notification in admin dashboard without page load whenever user place a new order from front end. please help me regarding this I have spend many hours on internet but didn't find any solution yet.
Or any suggestions how can it possible notifications process in PHP ?
Use a Manual Ajax call over the database at regular interval to check the last order id key is changed from current or not.
Get last order Id While loading
Call Ajax to check last order id is different or not
If differs do the push notification
I am making a website that will have a notification system that is like Facebook.
Each notification would redirect the user to a page, and on that page, I would mark any unread notification as 'read' as follows:
UPDATE notification SET status AS 'READ' WHERE ...
It is working well but the problem is every time when a user go to a page, even if there is no unread notification for the user, the query would still run. Though it does not make any difference to the end users, I wonder if it will create any performance issues.
I am thinking if I should update the database based on the click event on the notification dropdown. I want to listen to others about it first before implementing it. I want to know what's the normal practice when dealing with the notification system. Thanks!