@@ -32,12 +32,12 @@ class Thread extends Eloquent
32
32
* @var array
33
33
*/
34
34
protected $ dates = ['deleted_at ' ];
35
-
35
+
36
36
/**
37
- * Internal cache for creator.
38
- *
39
- * @var null|Models::user()
40
- */
37
+ * Internal cache for creator.
38
+ *
39
+ * @var null|Models::user()
40
+ */
41
41
protected $ creatorCache = null ;
42
42
43
43
/**
@@ -65,7 +65,7 @@ public function messages()
65
65
/**
66
66
* Returns the latest message from a thread.
67
67
*
68
- * @return \Cmgmyr\Messenger\Models\Message
68
+ * @return null| \Cmgmyr\Messenger\Models\Message
69
69
*/
70
70
public function getLatestMessageAttribute ()
71
71
{
@@ -114,22 +114,23 @@ public function creator()
114
114
/**
115
115
* Returns all of the latest threads by updated_at date.
116
116
*
117
- * @return self
117
+ * @return \Illuminate\Database\Query\Builder|static
118
118
*/
119
119
public static function getAllLatest ()
120
120
{
121
- return self ::latest ('updated_at ' );
121
+ return static ::latest ('updated_at ' );
122
122
}
123
123
124
124
/**
125
125
* Returns all threads by subject.
126
126
*
127
127
* @param string $subject
128
- * @return self
128
+ *
129
+ * @return \Illuminate\Database\Eloquent\Collection|static[]
129
130
*/
130
131
public static function getBySubject ($ subject )
131
132
{
132
- return self ::where ('subject ' , 'like ' , $ subject )->get ();
133
+ return static ::where ('subject ' , 'like ' , $ subject )->get ();
133
134
}
134
135
135
136
/**
@@ -155,10 +156,10 @@ public function participantsUserIds($userId = null)
155
156
/**
156
157
* Returns threads that the user is associated with.
157
158
*
158
- * @param Builder $query
159
- * @param $userId
159
+ * @param \Illuminate\Database\Eloquent\ Builder $query
160
+ * @param int $userId
160
161
*
161
- * @return Builder
162
+ * @return \Illuminate\Database\Eloquent\ Builder
162
163
*/
163
164
public function scopeForUser (Builder $ query , $ userId )
164
165
{
@@ -174,10 +175,10 @@ public function scopeForUser(Builder $query, $userId)
174
175
/**
175
176
* Returns threads with new messages that the user is associated with.
176
177
*
177
- * @param Builder $query
178
- * @param $userId
178
+ * @param \Illuminate\Database\Eloquent\ Builder $query
179
+ * @param int $userId
179
180
*
180
- * @return Builder
181
+ * @return \Illuminate\Database\Eloquent\ Builder
181
182
*/
182
183
public function scopeForUserWithNewMessages (Builder $ query , $ userId )
183
184
{
@@ -197,10 +198,10 @@ public function scopeForUserWithNewMessages(Builder $query, $userId)
197
198
/**
198
199
* Returns threads between given user ids.
199
200
*
200
- * @param Builder $query
201
+ * @param \Illuminate\Database\Eloquent\ Builder $query
201
202
* @param array $participants
202
203
*
203
- * @return Builder
204
+ * @return \Illuminate\Database\Eloquent\ Builder
204
205
*/
205
206
public function scopeBetween (Builder $ query , array $ participants )
206
207
{
@@ -216,6 +217,8 @@ public function scopeBetween(Builder $query, array $participants)
216
217
* Add users to thread as participants.
217
218
*
218
219
* @param array|mixed $userId
220
+ *
221
+ * @return void
219
222
*/
220
223
public function addParticipant ($ userId )
221
224
{
@@ -233,6 +236,8 @@ public function addParticipant($userId)
233
236
* Remove participants from thread.
234
237
*
235
238
* @param array|mixed $userId
239
+ *
240
+ * @return void
236
241
*/
237
242
public function removeParticipant ($ userId )
238
243
{
@@ -245,6 +250,8 @@ public function removeParticipant($userId)
245
250
* Mark a thread as read for a user.
246
251
*
247
252
* @param int $userId
253
+ *
254
+ * @return void
248
255
*/
249
256
public function markAsRead ($ userId )
250
257
{
@@ -286,7 +293,7 @@ public function isUnread($userId)
286
293
*
287
294
* @return mixed
288
295
*
289
- * @throws ModelNotFoundException
296
+ * @throws \Illuminate\Database\Eloquent\ ModelNotFoundException
290
297
*/
291
298
public function getParticipantFromUser ($ userId )
292
299
{
@@ -295,6 +302,8 @@ public function getParticipantFromUser($userId)
295
302
296
303
/**
297
304
* Restores all participants within a thread that has a new message.
305
+ *
306
+ * @return void
298
307
*/
299
308
public function activateAllParticipants ()
300
309
{
@@ -307,7 +316,7 @@ public function activateAllParticipants()
307
316
/**
308
317
* Generates a string of participant information.
309
318
*
310
- * @param null $userId
319
+ * @param null|int $userId
311
320
* @param array $columns
312
321
*
313
322
* @return string
@@ -335,7 +344,7 @@ public function participantsString($userId = null, $columns = ['name'])
335
344
/**
336
345
* Checks to see if a user is a current participant of the thread.
337
346
*
338
- * @param $userId
347
+ * @param int $userId
339
348
*
340
349
* @return bool
341
350
*/
@@ -352,7 +361,7 @@ public function hasParticipant($userId)
352
361
/**
353
362
* Generates a select string used in participantsString().
354
363
*
355
- * @param $columns
364
+ * @param array $columns
356
365
*
357
366
* @return string
358
367
*/
@@ -383,7 +392,7 @@ protected function createSelectString($columns)
383
392
/**
384
393
* Returns array of unread messages in thread for given user.
385
394
*
386
- * @param $userId
395
+ * @param int $userId
387
396
*
388
397
* @return \Illuminate\Support\Collection
389
398
*/
@@ -409,7 +418,7 @@ public function userUnreadMessages($userId)
409
418
/**
410
419
* Returns count of unread messages in thread for given user.
411
420
*
412
- * @param $userId
421
+ * @param int $userId
413
422
*
414
423
* @return int
415
424
*/
0 commit comments