@@ -66,7 +66,7 @@ public function __construct(array $attributes = [])
66
66
*
67
67
* @codeCoverageIgnore
68
68
*/
69
- public function messages (): HasMany
69
+ public function messages ()
70
70
{
71
71
return $ this ->hasMany (Models::classname (Message::class), 'thread_id ' , 'id ' );
72
72
}
@@ -88,7 +88,7 @@ public function getLatestMessageAttribute()
88
88
*
89
89
* @codeCoverageIgnore
90
90
*/
91
- public function participants (): HasMany
91
+ public function participants ()
92
92
{
93
93
return $ this ->hasMany (Models::classname (Participant::class), 'thread_id ' , 'id ' );
94
94
}
@@ -100,7 +100,7 @@ public function participants(): HasMany
100
100
*
101
101
* @codeCoverageIgnore
102
102
*/
103
- public function users (): BelongsToMany
103
+ public function users ()
104
104
{
105
105
return $ this ->belongsToMany (Models::classname ('User ' ), Models::table ('participants ' ), 'thread_id ' , 'user_id ' );
106
106
}
@@ -110,7 +110,7 @@ public function users(): BelongsToMany
110
110
*
111
111
* @return null|Models::user()|\Illuminate\Database\Eloquent\Model
112
112
*/
113
- public function creator (): ? Eloquent
113
+ public function creator ()
114
114
{
115
115
if ($ this ->creatorCache === null ) {
116
116
$ firstMessage = $ this ->messages ()->withTrashed ()->oldest ()->first ();
@@ -137,7 +137,7 @@ public static function getAllLatest()
137
137
*
138
138
* @return Collection|static[]
139
139
*/
140
- public static function getBySubject (string $ subject )
140
+ public static function getBySubject ($ subject )
141
141
{
142
142
return static ::where ('subject ' , 'like ' , $ subject )->get ();
143
143
}
@@ -149,7 +149,7 @@ public static function getBySubject(string $subject)
149
149
*
150
150
* @return array
151
151
*/
152
- public function participantsUserIds ($ userId = null ): array
152
+ public function participantsUserIds ($ userId = null )
153
153
{
154
154
$ users = $ this ->participants ()->withTrashed ()->select ('user_id ' )->get ()->map (function ($ participant ) {
155
155
return $ participant ->user_id ;
@@ -170,7 +170,7 @@ public function participantsUserIds($userId = null): array
170
170
*
171
171
* @return Builder
172
172
*/
173
- public function scopeForUser (Builder $ query , $ userId ): Builder
173
+ public function scopeForUser (Builder $ query , $ userId )
174
174
{
175
175
$ participantsTable = Models::table ('participants ' );
176
176
$ threadsTable = Models::table ('threads ' );
@@ -189,7 +189,7 @@ public function scopeForUser(Builder $query, $userId): Builder
189
189
*
190
190
* @return Builder
191
191
*/
192
- public function scopeForUserWithNewMessages (Builder $ query , $ userId ): Builder
192
+ public function scopeForUserWithNewMessages (Builder $ query , $ userId )
193
193
{
194
194
$ participantTable = Models::table ('participants ' );
195
195
$ threadsTable = Models::table ('threads ' );
@@ -212,7 +212,7 @@ public function scopeForUserWithNewMessages(Builder $query, $userId): Builder
212
212
*
213
213
* @return Builder
214
214
*/
215
- public function scopeBetweenOnly (Builder $ query , array $ participants ): Builder
215
+ public function scopeBetweenOnly (Builder $ query , array $ participants )
216
216
{
217
217
return $ query ->whereHas ('participants ' , function (Builder $ builder ) use ($ participants ) {
218
218
return $ builder ->whereIn ('user_id ' , $ participants )
@@ -230,7 +230,7 @@ public function scopeBetweenOnly(Builder $query, array $participants): Builder
230
230
*
231
231
* @return Builder
232
232
*/
233
- public function scopeBetween (Builder $ query , array $ participants ): Builder
233
+ public function scopeBetween (Builder $ query , array $ participants )
234
234
{
235
235
return $ query ->whereHas ('participants ' , function (Builder $ q ) use ($ participants ) {
236
236
$ q ->whereIn ('user_id ' , $ participants )
@@ -247,7 +247,7 @@ public function scopeBetween(Builder $query, array $participants): Builder
247
247
*
248
248
* @return void
249
249
*/
250
- public function addParticipant ($ userId ): void
250
+ public function addParticipant ($ userId )
251
251
{
252
252
$ userIds = is_array ($ userId ) ? $ userId : func_get_args ();
253
253
@@ -266,7 +266,7 @@ public function addParticipant($userId): void
266
266
*
267
267
* @return void
268
268
*/
269
- public function removeParticipant ($ userId ): void
269
+ public function removeParticipant ($ userId )
270
270
{
271
271
$ userIds = is_array ($ userId ) ? $ userId : func_get_args ();
272
272
@@ -280,7 +280,7 @@ public function removeParticipant($userId): void
280
280
*
281
281
* @return void
282
282
*/
283
- public function markAsRead ($ userId ): void
283
+ public function markAsRead ($ userId )
284
284
{
285
285
try {
286
286
$ participant = $ this ->getParticipantFromUser ($ userId );
@@ -298,7 +298,7 @@ public function markAsRead($userId): void
298
298
*
299
299
* @return bool
300
300
*/
301
- public function isUnread ($ userId ): bool
301
+ public function isUnread ($ userId )
302
302
{
303
303
try {
304
304
$ participant = $ this ->getParticipantFromUser ($ userId );
@@ -333,7 +333,7 @@ public function getParticipantFromUser($userId)
333
333
*
334
334
* @return void
335
335
*/
336
- public function activateAllParticipants (): void
336
+ public function activateAllParticipants ()
337
337
{
338
338
$ participants = $ this ->participants ()->onlyTrashed ()->get ();
339
339
foreach ($ participants as $ participant ) {
@@ -349,7 +349,7 @@ public function activateAllParticipants(): void
349
349
*
350
350
* @return string
351
351
*/
352
- public function participantsString ($ userId = null , array $ columns = ['name ' ]): string
352
+ public function participantsString ($ userId = null , $ columns = ['name ' ])
353
353
{
354
354
$ participantsTable = Models::table ('participants ' );
355
355
$ usersTable = Models::table ('users ' );
@@ -376,7 +376,7 @@ public function participantsString($userId = null, array $columns = ['name']): s
376
376
*
377
377
* @return bool
378
378
*/
379
- public function hasParticipant ($ userId ): bool
379
+ public function hasParticipant ($ userId )
380
380
{
381
381
$ participants = $ this ->participants ()->where ('user_id ' , '= ' , $ userId );
382
382
@@ -390,7 +390,7 @@ public function hasParticipant($userId): bool
390
390
*
391
391
* @return string
392
392
*/
393
- protected function createSelectString (array $ columns ): string
393
+ protected function createSelectString ($ columns )
394
394
{
395
395
$ dbDriver = $ this ->getConnection ()->getDriverName ();
396
396
$ tablePrefix = $ this ->getConnection ()->getTablePrefix ();
@@ -423,7 +423,7 @@ protected function createSelectString(array $columns): string
423
423
*
424
424
* @return Collection
425
425
*/
426
- public function userUnreadMessages ($ userId ): Collection
426
+ public function userUnreadMessages ($ userId )
427
427
{
428
428
$ messages = $ this ->messages ()->where ('user_id ' , '!= ' , $ userId )->get ();
429
429
@@ -449,7 +449,7 @@ public function userUnreadMessages($userId): Collection
449
449
*
450
450
* @return int
451
451
*/
452
- public function userUnreadMessagesCount ($ userId ): int
452
+ public function userUnreadMessagesCount ($ userId )
453
453
{
454
454
return $ this ->userUnreadMessages ($ userId )->count ();
455
455
}
0 commit comments