@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | $values = $request->validated(); |
51 | 51 | $user = $request->user(); |
52 | 52 | $thread = $this->service->newThread( |
53 | - $values['subject'], |
|
53 | + $values[ 'subject' ], |
|
54 | 54 | $user, |
55 | - $values['content'], |
|
56 | - Arr::get($values, 'recipients', []) |
|
55 | + $values[ 'content' ], |
|
56 | + Arr::get($values, 'recipients', [ ]) |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | return new ThreadResource($thread); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $message = $this->service->newMessage( |
86 | 86 | $thread, |
87 | 87 | $user, |
88 | - $values['body'], |
|
88 | + $values[ 'body' ], |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | return new MessageResource($message); |
@@ -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 | Notification::send($recipients, new ThreadCreated($thread)); |
112 | 112 | return $thread; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'user_id' => $user->id, |
184 | 184 | 'thread_id' => $thread->id, |
185 | 185 | ], |
186 | - $mark_as_read ? ['last_read' => now()] : []); |
|
186 | + $mark_as_read ? [ 'last_read' => now() ] : [ ]); |
|
187 | 187 | |
188 | 188 | $users = $thread->users()->get(); |
189 | 189 |