laravel-expo-notifier
laravel-expo-notifier copied to clipboard
Add notifiable to expo notification
This PR follow this one : #41
Link expo notification to it's receiver
Problem
To avoid sending multiple time the same notification for a user, we need to add an id in the data that is sent to expo and check with something like this JSON_CONTAINS(JSON_UNQUOTE(JSON_EXTRACT(expo_notifications.data, \'$.data\')),\'"' . $user->id. '"\',\'$.user_id\')
It is not really easy and have some performance losses.
Solution
Add a nullableMorph receiver to the expo_notifications table.
close #24
By the way, it would be nice to not set all classes as final to allow some flexibility for storing notification or anything else. I still need to use some JSON_CONTAINS in sql in order to keep trace of the type of notification i've send.
So extending the notification store class would allow adding a type attribute in my notification table or any other custom attributes.
it seems even more relevant when you see that you can pass any class in the package config.