@@ -14,5 +14,5 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @var array |
| 16 | 16 | */ |
| 17 | - protected $dates = ['last_read', 'created_at', 'updated_at', 'deleted_at']; |
|
| 17 | + protected $dates = [ 'last_read', 'created_at', 'updated_at', 'deleted_at' ]; |
|
| 18 | 18 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function via($notifiable) |
| 31 | 31 | { |
| 32 | - return ['mail']; |
|
| 32 | + return [ 'mail' ]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | protected function redirectTo($request) |
| 16 | 16 | { |
| 17 | - if (! $request->expectsJson()) { |
|
| 17 | + if (!$request->expectsJson()) { |
|
| 18 | 18 | return route('login'); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function pushNotification(MessageServiceInterface $messageService) |
| 12 | 12 | { |
| 13 | 13 | $subject = 'PING '.now(); |
| 14 | - $messageService->newThread($subject, Auth::user(), ['DUMMY PING']); |
|
| 14 | + $messageService->newThread($subject, Auth::user(), [ 'DUMMY PING' ]); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function render() |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | $values = $request->validated(); |
| 51 | 51 | $user = $request->user(); |
| 52 | 52 | $threads = $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($threads); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $message = $this->service->newMessage( |
| 86 | 86 | $thread, |
| 87 | 87 | $user, |
| 88 | - $values['content'], |
|
| 88 | + $values[ 'content' ], |
|
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | return new MessageResource($message); |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function callback(string $provider, Request $request) |
| 76 | 76 | { |
| 77 | - $client = $request->session()->get('client', []); |
|
| 77 | + $client = $request->session()->get('client', [ ]); |
|
| 78 | 78 | $user = $this->service->callback($provider, $client); |
| 79 | 79 | $URI = Arr::get($client, 'redirect_uri', false); |
| 80 | 80 | |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | protected static function bootHasUUID() |
| 13 | 13 | { |
| 14 | - static::creating(function ($model) { |
|
| 14 | + static::creating(function($model) { |
|
| 15 | 15 | /* |
| 16 | 16 | * @var \Illuminate\Database\Eloquent\Model |
| 17 | 17 | */ |
| 18 | - if (! $model->getKey()) { |
|
| 18 | + if (!$model->getKey()) { |
|
| 19 | 19 | $model->{$model->getKeyName()} = Str::uuid()->toString(); |
| 20 | 20 | } |
| 21 | 21 | }); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function thread(string $thread_id): Thread |
| 49 | 49 | { |
| 50 | - return Thread::with(['messages', 'participants.user'])->find($thread_id); |
|
| 50 | + return Thread::with([ 'messages', 'participants.user' ])->find($thread_id); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param null|array $recipients |
| 71 | 71 | * @return Thread |
| 72 | 72 | */ |
| 73 | - public function newThread(string $subject, User $user, array $content, ?array $recipients = []): Thread |
|
| 73 | + public function newThread(string $subject, User $user, array $content, ?array $recipients = [ ]): Thread |
|
| 74 | 74 | { |
| 75 | 75 | /** @var $thread Thread */ |
| 76 | 76 | $thread = Thread::create([ |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // Recipients are participants too |
| 81 | 81 | collect($recipients) |
| 82 | - ->map(function ($recipient) { |
|
| 82 | + ->map(function($recipient) { |
|
| 83 | 83 | return User::find($recipient); |
| 84 | 84 | }) |
| 85 | 85 | ->filter() |
| 86 | - ->each(function ($recipient) use ($thread) { |
|
| 86 | + ->each(function($recipient) use ($thread) { |
|
| 87 | 87 | $this->addParticipant($thread, $recipient); |
| 88 | 88 | }); |
| 89 | 89 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | 'user_id' => $user->id, |
| 167 | 167 | 'thread_id' => $thread->id, |
| 168 | 168 | ], |
| 169 | - $mark_as_read ? ['last_read' => now()] : []); |
|
| 169 | + $mark_as_read ? [ 'last_read' => now() ] : [ ]); |
|
| 170 | 170 | |
| 171 | 171 | $users = $thread->users()->get(); |
| 172 | 172 | |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | public function user(string $provider, UserContract $userContract): User |
| 83 | 83 | { |
| 84 | 84 | return User::updateOrCreate([ |
| 85 | - 'provider_name' => $provider, // GitHub, LinkedIn, Google, Apple |
|
| 86 | - 'provider_id' => $userContract->getId(), // unsignedBigInteger, uuid |
|
| 85 | + 'provider_name' => $provider, // GitHub, LinkedIn, Google, Apple |
|
| 86 | + 'provider_id' => $userContract->getId(), // unsignedBigInteger, uuid |
|
| 87 | 87 | ], [ |
| 88 | 88 | 'name' => $userContract->getName() ?? $userContract->getNickname(), |
| 89 | 89 | /** |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | * Tokens for retrieve data from authorization |
| 93 | 93 | * server such as GitHub, Twitter or Google. |
| 94 | 94 | */ |
| 95 | - 'email' => $userContract->getEmail(), // OAuth provider e-mail address |
|
| 96 | - 'notify_via' => ['broadcast'], // Default notification preference |
|
| 97 | - 'access_token' => $userContract->token, // TOKEN |
|
| 98 | - 'refresh_token' => $userContract->refreshToken, // TOKEN - some providers have it |
|
| 99 | - 'profile' => $userContract->user, // JSON profile data |
|
| 95 | + 'email' => $userContract->getEmail(), // OAuth provider e-mail address |
|
| 96 | + 'notify_via' => [ 'broadcast' ], // Default notification preference |
|
| 97 | + 'access_token' => $userContract->token, // TOKEN |
|
| 98 | + 'refresh_token' => $userContract->refreshToken, // TOKEN - some providers have it |
|
| 99 | + 'profile' => $userContract->user, // JSON profile data |
|
| 100 | 100 | ]); |
| 101 | 101 | } |
| 102 | 102 | |