1 | <?php |
||
24 | trait NotificationReadTrait |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * |
||
29 | * @param BaseUserModel $user |
||
30 | * @param BaseMongoNotificationModel|BaseNotificationModel $notification |
||
31 | * @return boolean False if notification was marked as read or it didn't exist. |
||
32 | */ |
||
33 | 3 | public static function read($user, $notification) |
|
44 | |||
45 | /** |
||
46 | * |
||
47 | * @param BaseUserModel $user |
||
48 | * @param BaseMongoNotificationModel|BaseNotificationModel $notification |
||
49 | * @return boolean True if notification was marked as unread or it didn't exist. |
||
50 | */ |
||
51 | 3 | public static function unread($user, $notification) |
|
62 | |||
63 | /** |
||
64 | * Check if $notification is read by $user. |
||
65 | * @param BaseUserModel $user |
||
66 | * @param BaseMongoNotificationModel|BaseNotificationModel $notification |
||
67 | * @return boolean |
||
68 | */ |
||
69 | public static function isRead($user, $notification) |
||
76 | |||
77 | /** |
||
78 | * Vacuum all the invalid notification read records. |
||
79 | * @param BaseUserModel $user |
||
80 | * @param string $notificationClass |
||
81 | * @return integer The sum of notification read records vacuumed. |
||
82 | */ |
||
83 | 2 | public static function vacuum($user, $notificationClass) |
|
95 | } |
||
96 |