@@ -66,7 +66,7 @@ public function __construct(array $attributes = [])
6666 *
6767 * @codeCoverageIgnore
6868 */
69- public function messages (): HasMany
69+ public function messages ()
7070 {
7171 return $ this ->hasMany (Models::classname (Message::class), 'thread_id ' , 'id ' );
7272 }
@@ -88,7 +88,7 @@ public function getLatestMessageAttribute()
8888 *
8989 * @codeCoverageIgnore
9090 */
91- public function participants (): HasMany
91+ public function participants ()
9292 {
9393 return $ this ->hasMany (Models::classname (Participant::class), 'thread_id ' , 'id ' );
9494 }
@@ -100,7 +100,7 @@ public function participants(): HasMany
100100 *
101101 * @codeCoverageIgnore
102102 */
103- public function users (): BelongsToMany
103+ public function users ()
104104 {
105105 return $ this ->belongsToMany (Models::classname ('User ' ), Models::table ('participants ' ), 'thread_id ' , 'user_id ' );
106106 }
@@ -110,7 +110,7 @@ public function users(): BelongsToMany
110110 *
111111 * @return null|Models::user()|\Illuminate\Database\Eloquent\Model
112112 */
113- public function creator (): ? Eloquent
113+ public function creator ()
114114 {
115115 if ($ this ->creatorCache === null ) {
116116 $ firstMessage = $ this ->messages ()->withTrashed ()->oldest ()->first ();
@@ -137,7 +137,7 @@ public static function getAllLatest()
137137 *
138138 * @return Collection|static[]
139139 */
140- public static function getBySubject (string $ subject )
140+ public static function getBySubject ($ subject )
141141 {
142142 return static ::where ('subject ' , 'like ' , $ subject )->get ();
143143 }
@@ -149,7 +149,7 @@ public static function getBySubject(string $subject)
149149 *
150150 * @return array
151151 */
152- public function participantsUserIds ($ userId = null ): array
152+ public function participantsUserIds ($ userId = null )
153153 {
154154 $ users = $ this ->participants ()->withTrashed ()->select ('user_id ' )->get ()->map (function ($ participant ) {
155155 return $ participant ->user_id ;
@@ -170,7 +170,7 @@ public function participantsUserIds($userId = null): array
170170 *
171171 * @return Builder
172172 */
173- public function scopeForUser (Builder $ query , $ userId ): Builder
173+ public function scopeForUser (Builder $ query , $ userId )
174174 {
175175 $ participantsTable = Models::table ('participants ' );
176176 $ threadsTable = Models::table ('threads ' );
@@ -189,7 +189,7 @@ public function scopeForUser(Builder $query, $userId): Builder
189189 *
190190 * @return Builder
191191 */
192- public function scopeForUserWithNewMessages (Builder $ query , $ userId ): Builder
192+ public function scopeForUserWithNewMessages (Builder $ query , $ userId )
193193 {
194194 $ participantTable = Models::table ('participants ' );
195195 $ threadsTable = Models::table ('threads ' );
@@ -212,7 +212,7 @@ public function scopeForUserWithNewMessages(Builder $query, $userId): Builder
212212 *
213213 * @return Builder
214214 */
215- public function scopeBetweenOnly (Builder $ query , array $ participants ): Builder
215+ public function scopeBetweenOnly (Builder $ query , array $ participants )
216216 {
217217 return $ query ->whereHas ('participants ' , function (Builder $ builder ) use ($ participants ) {
218218 return $ builder ->whereIn ('user_id ' , $ participants )
@@ -230,7 +230,7 @@ public function scopeBetweenOnly(Builder $query, array $participants): Builder
230230 *
231231 * @return Builder
232232 */
233- public function scopeBetween (Builder $ query , array $ participants ): Builder
233+ public function scopeBetween (Builder $ query , array $ participants )
234234 {
235235 return $ query ->whereHas ('participants ' , function (Builder $ q ) use ($ participants ) {
236236 $ q ->whereIn ('user_id ' , $ participants )
@@ -247,7 +247,7 @@ public function scopeBetween(Builder $query, array $participants): Builder
247247 *
248248 * @return void
249249 */
250- public function addParticipant ($ userId ): void
250+ public function addParticipant ($ userId )
251251 {
252252 $ userIds = is_array ($ userId ) ? $ userId : func_get_args ();
253253
@@ -266,7 +266,7 @@ public function addParticipant($userId): void
266266 *
267267 * @return void
268268 */
269- public function removeParticipant ($ userId ): void
269+ public function removeParticipant ($ userId )
270270 {
271271 $ userIds = is_array ($ userId ) ? $ userId : func_get_args ();
272272
@@ -280,7 +280,7 @@ public function removeParticipant($userId): void
280280 *
281281 * @return void
282282 */
283- public function markAsRead ($ userId ): void
283+ public function markAsRead ($ userId )
284284 {
285285 try {
286286 $ participant = $ this ->getParticipantFromUser ($ userId );
@@ -298,7 +298,7 @@ public function markAsRead($userId): void
298298 *
299299 * @return bool
300300 */
301- public function isUnread ($ userId ): bool
301+ public function isUnread ($ userId )
302302 {
303303 try {
304304 $ participant = $ this ->getParticipantFromUser ($ userId );
@@ -333,7 +333,7 @@ public function getParticipantFromUser($userId)
333333 *
334334 * @return void
335335 */
336- public function activateAllParticipants (): void
336+ public function activateAllParticipants ()
337337 {
338338 $ participants = $ this ->participants ()->onlyTrashed ()->get ();
339339 foreach ($ participants as $ participant ) {
@@ -349,7 +349,7 @@ public function activateAllParticipants(): void
349349 *
350350 * @return string
351351 */
352- public function participantsString ($ userId = null , array $ columns = ['name ' ]): string
352+ public function participantsString ($ userId = null , $ columns = ['name ' ])
353353 {
354354 $ participantsTable = Models::table ('participants ' );
355355 $ usersTable = Models::table ('users ' );
@@ -376,7 +376,7 @@ public function participantsString($userId = null, array $columns = ['name']): s
376376 *
377377 * @return bool
378378 */
379- public function hasParticipant ($ userId ): bool
379+ public function hasParticipant ($ userId )
380380 {
381381 $ participants = $ this ->participants ()->where ('user_id ' , '= ' , $ userId );
382382
@@ -390,7 +390,7 @@ public function hasParticipant($userId): bool
390390 *
391391 * @return string
392392 */
393- protected function createSelectString (array $ columns ): string
393+ protected function createSelectString ($ columns )
394394 {
395395 $ dbDriver = $ this ->getConnection ()->getDriverName ();
396396 $ tablePrefix = $ this ->getConnection ()->getTablePrefix ();
@@ -423,7 +423,7 @@ protected function createSelectString(array $columns): string
423423 *
424424 * @return Collection
425425 */
426- public function userUnreadMessages ($ userId ): Collection
426+ public function userUnreadMessages ($ userId )
427427 {
428428 $ messages = $ this ->messages ()->where ('user_id ' , '!= ' , $ userId )->get ();
429429
@@ -449,7 +449,7 @@ public function userUnreadMessages($userId): Collection
449449 *
450450 * @return int
451451 */
452- public function userUnreadMessagesCount ($ userId ): int
452+ public function userUnreadMessagesCount ($ userId )
453453 {
454454 return $ this ->userUnreadMessages ($ userId )->count ();
455455 }
0 commit comments