1 | <?php |
||
10 | trait NotifableBasic |
||
11 | { |
||
12 | /** |
||
13 | * Get the notifications Relationship. |
||
14 | * |
||
15 | * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany |
||
16 | */ |
||
17 | abstract public function getNotificationRelation(); |
||
18 | |||
19 | /** |
||
20 | * Get a new NotifynderManager instance with the given category. |
||
21 | * |
||
22 | * @param string|int|\Fenos\Notifynder\Models\NotificationCategory $category |
||
23 | * @return \Fenos\Notifynder\Managers\NotifynderManager |
||
24 | */ |
||
25 | public function notifynder($category) |
||
29 | |||
30 | /** |
||
31 | * Get a new NotifynderManager instance with the given category and $this as the sender. |
||
32 | * |
||
33 | * @param string|int|\Fenos\Notifynder\Models\NotificationCategory $category |
||
34 | * @return \Fenos\Notifynder\Managers\NotifynderManager |
||
35 | */ |
||
36 | public function sendNotificationFrom($category) |
||
40 | |||
41 | /** |
||
42 | * Get a new NotifynderManager instance with the given category and $this as the receiver. |
||
43 | * |
||
44 | * @param string|int|\Fenos\Notifynder\Models\NotificationCategory $category |
||
45 | * @return \Fenos\Notifynder\Managers\NotifynderManager |
||
46 | */ |
||
47 | public function sendNotificationTo($category) |
||
51 | |||
52 | /** |
||
53 | * Read a single Notification. |
||
54 | * |
||
55 | * @param int $notification |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function readNotification($notification) |
||
62 | |||
63 | /** |
||
64 | * Unread a single Notification. |
||
65 | * |
||
66 | * @param int $notification |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function unreadNotification($notification) |
||
73 | |||
74 | /** |
||
75 | * @param int $notification |
||
76 | * @param int $value |
||
77 | * @return bool |
||
78 | */ |
||
79 | protected function updateSingleReadStatus($notification, $value) |
||
91 | |||
92 | /** |
||
93 | * Read all Notifications. |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | public function readAllNotifications() |
||
101 | |||
102 | /** |
||
103 | * Unread all Notifications. |
||
104 | * |
||
105 | * @return mixed |
||
106 | */ |
||
107 | public function unreadAllNotifications() |
||
111 | |||
112 | /** |
||
113 | * Count unread notifications. |
||
114 | * |
||
115 | * @return int |
||
116 | */ |
||
117 | public function countUnreadNotifications() |
||
121 | |||
122 | /** |
||
123 | * Get all Notifications ordered by creation and optional limit. |
||
124 | * |
||
125 | * @param null|int $limit |
||
126 | * @param string $order |
||
127 | * @return \Illuminate\Database\Eloquent\Collection |
||
128 | */ |
||
129 | public function getNotifications($limit = null, $order = 'desc') |
||
138 | |||
139 | /** |
||
140 | * Get all unread Notifications. |
||
141 | * |
||
142 | * @param null|int $limit |
||
143 | * @param string $order |
||
144 | * @return \Illuminate\Database\Eloquent\Collection |
||
145 | */ |
||
146 | public function getNotificationsNotRead($limit = null, $order = 'desc') |
||
156 | } |
||
157 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: