1

I am using database notification along with GCM and APN push notifications to send notifications.

My requirement is to mark the notification read, if a user clicks on the push notification in mobile. But only one notification need to be get updated, so the database notification id need to be passed in push notification. Is there any way to do this?

Jithin
  • 2,594
  • 1
  • 22
  • 42

3 Answers3

3

$this->id will contain the notification id. The same id will be inserted in the database if database is given as a channel method.

Jithin
  • 2,594
  • 1
  • 22
  • 42
-1

You can pass the notification id and user id in the payload which will be available at the client side. You can just make a webhook to send the notification id and user id with event read.

The payload in GCM looks like this payload = {:time_to_live => xxx,:data => {:id => xxx ,:user_id => xxx} ,:collapse_key => xxx,:delay_while_idle => true}

gcm_object.send_notification(registration_ids, payload)

Gaudam Thiyagarajan
  • 1,022
  • 9
  • 24
-1

You can use is_read column in DB and it will get updated through the laravel API when user click on notification..after user redirect to the url associated with notification message

Manoj Patel
  • 329
  • 3
  • 11