@@ -32,12 +32,12 @@ class Thread extends Eloquent
3232 * @var array
3333 */
3434 protected $ dates = ['deleted_at ' ];
35-
35+
3636 /**
37- * Internal cache for creator.
38- *
39- * @var null|Models::user()
40- */
37+ * Internal cache for creator.
38+ *
39+ * @var null|Models::user()
40+ */
4141 protected $ creatorCache = null ;
4242
4343 /**
@@ -65,7 +65,7 @@ public function messages()
6565 /**
6666 * Returns the latest message from a thread.
6767 *
68- * @return \Cmgmyr\Messenger\Models\Message
68+ * @return null| \Cmgmyr\Messenger\Models\Message
6969 */
7070 public function getLatestMessageAttribute ()
7171 {
@@ -114,22 +114,23 @@ public function creator()
114114 /**
115115 * Returns all of the latest threads by updated_at date.
116116 *
117- * @return self
117+ * @return \Illuminate\Database\Query\Builder|static
118118 */
119119 public static function getAllLatest ()
120120 {
121- return self ::latest ('updated_at ' );
121+ return static ::latest ('updated_at ' );
122122 }
123123
124124 /**
125125 * Returns all threads by subject.
126126 *
127127 * @param string $subject
128- * @return self
128+ *
129+ * @return \Illuminate\Database\Eloquent\Collection|static[]
129130 */
130131 public static function getBySubject ($ subject )
131132 {
132- return self ::where ('subject ' , 'like ' , $ subject )->get ();
133+ return static ::where ('subject ' , 'like ' , $ subject )->get ();
133134 }
134135
135136 /**
@@ -155,10 +156,10 @@ public function participantsUserIds($userId = null)
155156 /**
156157 * Returns threads that the user is associated with.
157158 *
158- * @param Builder $query
159- * @param $userId
159+ * @param \Illuminate\Database\Eloquent\ Builder $query
160+ * @param int $userId
160161 *
161- * @return Builder
162+ * @return \Illuminate\Database\Eloquent\ Builder
162163 */
163164 public function scopeForUser (Builder $ query , $ userId )
164165 {
@@ -174,10 +175,10 @@ public function scopeForUser(Builder $query, $userId)
174175 /**
175176 * Returns threads with new messages that the user is associated with.
176177 *
177- * @param Builder $query
178- * @param $userId
178+ * @param \Illuminate\Database\Eloquent\ Builder $query
179+ * @param int $userId
179180 *
180- * @return Builder
181+ * @return \Illuminate\Database\Eloquent\ Builder
181182 */
182183 public function scopeForUserWithNewMessages (Builder $ query , $ userId )
183184 {
@@ -197,10 +198,10 @@ public function scopeForUserWithNewMessages(Builder $query, $userId)
197198 /**
198199 * Returns threads between given user ids.
199200 *
200- * @param Builder $query
201+ * @param \Illuminate\Database\Eloquent\ Builder $query
201202 * @param array $participants
202203 *
203- * @return Builder
204+ * @return \Illuminate\Database\Eloquent\ Builder
204205 */
205206 public function scopeBetween (Builder $ query , array $ participants )
206207 {
@@ -216,6 +217,8 @@ public function scopeBetween(Builder $query, array $participants)
216217 * Add users to thread as participants.
217218 *
218219 * @param array|mixed $userId
220+ *
221+ * @return void
219222 */
220223 public function addParticipant ($ userId )
221224 {
@@ -233,6 +236,8 @@ public function addParticipant($userId)
233236 * Remove participants from thread.
234237 *
235238 * @param array|mixed $userId
239+ *
240+ * @return void
236241 */
237242 public function removeParticipant ($ userId )
238243 {
@@ -245,6 +250,8 @@ public function removeParticipant($userId)
245250 * Mark a thread as read for a user.
246251 *
247252 * @param int $userId
253+ *
254+ * @return void
248255 */
249256 public function markAsRead ($ userId )
250257 {
@@ -286,7 +293,7 @@ public function isUnread($userId)
286293 *
287294 * @return mixed
288295 *
289- * @throws ModelNotFoundException
296+ * @throws \Illuminate\Database\Eloquent\ ModelNotFoundException
290297 */
291298 public function getParticipantFromUser ($ userId )
292299 {
@@ -295,6 +302,8 @@ public function getParticipantFromUser($userId)
295302
296303 /**
297304 * Restores all participants within a thread that has a new message.
305+ *
306+ * @return void
298307 */
299308 public function activateAllParticipants ()
300309 {
@@ -307,7 +316,7 @@ public function activateAllParticipants()
307316 /**
308317 * Generates a string of participant information.
309318 *
310- * @param null $userId
319+ * @param null|int $userId
311320 * @param array $columns
312321 *
313322 * @return string
@@ -335,7 +344,7 @@ public function participantsString($userId = null, $columns = ['name'])
335344 /**
336345 * Checks to see if a user is a current participant of the thread.
337346 *
338- * @param $userId
347+ * @param int $userId
339348 *
340349 * @return bool
341350 */
@@ -352,7 +361,7 @@ public function hasParticipant($userId)
352361 /**
353362 * Generates a select string used in participantsString().
354363 *
355- * @param $columns
364+ * @param array $columns
356365 *
357366 * @return string
358367 */
@@ -383,7 +392,7 @@ protected function createSelectString($columns)
383392 /**
384393 * Returns array of unread messages in thread for given user.
385394 *
386- * @param $userId
395+ * @param int $userId
387396 *
388397 * @return \Illuminate\Support\Collection
389398 */
@@ -409,7 +418,7 @@ public function userUnreadMessages($userId)
409418 /**
410419 * Returns count of unread messages in thread for given user.
411420 *
412- * @param $userId
421+ * @param int $userId
413422 *
414423 * @return int
415424 */
0 commit comments