1 | <?php |
||
11 | class NotificationService |
||
12 | { |
||
13 | public function __construct( |
||
20 | |||
21 | /** |
||
22 | * All notifications |
||
23 | * |
||
24 | * @return Collection |
||
25 | */ |
||
26 | public function all() |
||
30 | |||
31 | /** |
||
32 | * Paginated notifications |
||
33 | * |
||
34 | * @return PaginatedCollection |
||
35 | */ |
||
36 | public function paginated() |
||
40 | |||
41 | /** |
||
42 | * User based paginated notifications |
||
43 | * |
||
44 | * @param integer $id |
||
45 | * @return PaginatedCollection |
||
46 | */ |
||
47 | public function userBasedPaginated($id) |
||
51 | |||
52 | /** |
||
53 | * User based notifications |
||
54 | * |
||
55 | * @param integer $id |
||
56 | * @return Collection |
||
57 | */ |
||
58 | public function userBased($id) |
||
62 | |||
63 | /** |
||
64 | * Search notifications |
||
65 | * |
||
66 | * @param string $input |
||
67 | * @param integer $id |
||
68 | * @return Collection |
||
69 | */ |
||
70 | public function search($input, $id) |
||
87 | |||
88 | /** |
||
89 | * Create a notificaton |
||
90 | * |
||
91 | * @param integer $userId |
||
92 | * @param string $flag |
||
93 | * @param string $title |
||
94 | * @param string $details |
||
95 | * @return void |
||
96 | */ |
||
97 | public function notify($userId, $flag, $title, $details) |
||
109 | |||
110 | /** |
||
111 | * Create a notification |
||
112 | * |
||
113 | * @param array $input |
||
114 | * @return boolean|exception |
||
115 | */ |
||
116 | public function create($input) |
||
157 | |||
158 | /** |
||
159 | * Get a user |
||
160 | * |
||
161 | * @param integer $id |
||
162 | * @return User |
||
163 | */ |
||
164 | public function getUser($id) |
||
168 | |||
169 | /** |
||
170 | * Find a notification |
||
171 | * |
||
172 | * @param integer $id |
||
173 | * @return Notification |
||
174 | */ |
||
175 | public function find($id) |
||
179 | |||
180 | /** |
||
181 | * Find a notification by UUID |
||
182 | * |
||
183 | * @param string $uuid |
||
184 | * @return Notification |
||
185 | */ |
||
186 | public function findByUuid($uuid) |
||
190 | |||
191 | /** |
||
192 | * Update a notification |
||
193 | * |
||
194 | * @param integer $id |
||
195 | * @param array $input |
||
196 | * @return Notification |
||
197 | */ |
||
198 | public function update($id, $input) |
||
215 | |||
216 | /** |
||
217 | * Mark notification as read |
||
218 | * |
||
219 | * @param integer $id |
||
220 | * @return boolean |
||
221 | */ |
||
222 | public function markAsRead($id) |
||
227 | |||
228 | /** |
||
229 | * Destroy a Notification |
||
230 | * |
||
231 | * @param integer $id |
||
232 | * @return boolean |
||
233 | */ |
||
234 | public function destroy($id) |
||
238 | |||
239 | /** |
||
240 | * Users as Select options array |
||
241 | * |
||
242 | * @return Array |
||
243 | */ |
||
244 | public function usersAsOptions() |
||
254 | } |
||
255 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: