@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function thread(string $thread_id): Thread |
| 65 | 65 | { |
| 66 | - return Thread::with(['messages', 'participants.user'])->find($thread_id); |
|
| 66 | + return Thread::with([ 'messages', 'participants.user' ])->find($thread_id); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param null|array $recipients |
| 87 | 87 | * @return Thread |
| 88 | 88 | */ |
| 89 | - public function newThread(string $subject, User $user, array $content, ?array $recipients = []): Thread |
|
| 89 | + public function newThread(string $subject, User $user, array $content, ?array $recipients = [ ]): Thread |
|
| 90 | 90 | { |
| 91 | 91 | /** @var $thread Thread */ |
| 92 | 92 | $thread = Thread::create([ |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // Recipients are participants too |
| 99 | 99 | $recipients = collect($recipients) |
| 100 | - ->map(function ($recipient) { |
|
| 100 | + ->map(function($recipient) { |
|
| 101 | 101 | return User::find($recipient); |
| 102 | 102 | }) |
| 103 | 103 | ->add($user) |
| 104 | 104 | ->unique('id') |
| 105 | - ->map(function ($recipient) use ($thread) { |
|
| 105 | + ->map(function($recipient) use ($thread) { |
|
| 106 | 106 | return $this->addParticipant($thread, $recipient); |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | - $thread->setRelation('messages', collect([$message])); |
|
| 109 | + $thread->setRelation('messages', collect([ $message ])); |
|
| 110 | 110 | $thread->setRelation('participants', $recipients); |
| 111 | 111 | $users = User::find($recipients->pluck('user_id')); |
| 112 | 112 | Notification::send($users, new ThreadCreated($thread)); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | 'user_id' => $user->id, |
| 185 | 185 | 'thread_id' => $thread->id, |
| 186 | 186 | ], |
| 187 | - $mark_as_read ? ['last_read' => now()] : []); |
|
| 187 | + $mark_as_read ? [ 'last_read' => now() ] : [ ]); |
|
| 188 | 188 | |
| 189 | 189 | $users = $thread->users()->get(); |
| 190 | 190 | |