@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $parser = app('parser.wiki'); |
31 | 31 | $wiki->load(['comments' => function ($query) { |
32 | - return $query->orderByDesc('updated_at')->with(['user' => fn ($query) => $query->withTrashed()]); |
|
32 | + return $query->orderByDesc('updated_at')->with(['user' => fn($query) => $query->withTrashed()]); |
|
33 | 33 | }]); |
34 | 34 | |
35 | 35 | foreach ($wiki->comments as &$comment) { |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function broadcastOn() |
40 | 40 | { |
41 | - return new Channel('topic:' . $this->comment->post?->topic_id); |
|
41 | + return new Channel('topic:' . $this->comment->post ? ->topic_id); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | public function voters(Microblog $microblog) |
100 | 100 | { |
101 | - $microblog->load(['voters', 'voters.user' => fn ($query) => $query->select('id', 'name')->withTrashed()]); |
|
101 | + $microblog->load(['voters', 'voters.user' => fn($query) => $query->select('id', 'name')->withTrashed()]); |
|
102 | 102 | |
103 | 103 | return ['id' => $microblog->id, 'parent_id' => $microblog->parent_id, 'users' => $microblog->voters->pluck('user.name')]; |
104 | 104 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | |
88 | 88 | public function voters(Post $post) |
89 | 89 | { |
90 | - $post->load(['votes', 'user' => fn ($query) => $query->select('id', 'name')->withTrashed()]); |
|
90 | + $post->load(['votes', 'user' => fn($query) => $query->select('id', 'name')->withTrashed()]); |
|
91 | 91 | |
92 | 92 | return [ |
93 | 93 | 'id' => $post->id, |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | public function parse(string $text): string |
36 | 36 | { |
37 | - return $this->urlPattern->replace($text)->callback(fn (Detail $match) => $this->processLink($match->text())); |
|
37 | + return $this->urlPattern->replace($text)->callback(fn(Detail $match) => $this->processLink($match->text())); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | private function processLink(string $url): string |
@@ -13,17 +13,17 @@ |
||
13 | 13 | { |
14 | 14 | public function handleTopicDelete(TopicDeleted $event) |
15 | 15 | { |
16 | - Flag::whereHas('topics', fn (Builder $query) => $query->withTrashed()->where('id', $event->topic['id']))->delete(); |
|
16 | + Flag::whereHas('topics', fn(Builder $query) => $query->withTrashed()->where('id', $event->topic['id']))->delete(); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function handlePostDelete(PostWasDeleted $event) |
20 | 20 | { |
21 | - Flag::whereHas('posts', fn (Builder $query) => $query->withTrashed()->where('id', $event->post['id']))->delete(); |
|
21 | + Flag::whereHas('posts', fn(Builder $query) => $query->withTrashed()->where('id', $event->post['id']))->delete(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function handleMicroblogDelete(MicroblogDeleted $event) |
25 | 25 | { |
26 | - Flag::whereHas('microblogs', fn (Builder $query) => $query->withTrashed()->where('id', $event->microblog['id']))->delete(); |
|
26 | + Flag::whereHas('microblogs', fn(Builder $query) => $query->withTrashed()->where('id', $event->microblog['id']))->delete(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function subscribe($events) |
@@ -15,9 +15,9 @@ |
||
15 | 15 | */ |
16 | 16 | protected $preserveKeys = true; |
17 | 17 | |
18 | - protected Guide|Job $owner; |
|
18 | + protected Guide | Job $owner; |
|
19 | 19 | |
20 | - public function setOwner(Guide|Job $owner): static |
|
20 | + public function setOwner(Guide | Job $owner): static |
|
21 | 21 | { |
22 | 22 | $this->owner = $owner; |
23 | 23 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | array_only(parent::toArray($request), ['id', 'text', 'email', 'html', 'parent_id']), |
33 | 33 | [ |
34 | 34 | 'created_at' => $this->created_at->toIso8601String(), |
35 | - 'children' => $this->whenLoaded('children', fn () => CommentResource::collection($this->children)->keyBy('id'), []), |
|
35 | + 'children' => $this->whenLoaded('children', fn() => CommentResource::collection($this->children)->keyBy('id'), []), |
|
36 | 36 | 'is_owner' => $this->resource->resource->user_id === $this->user_id, |
37 | 37 | |
38 | 38 | 'url' => UrlBuilder::url($this->resource->resource) . '#comment-' . $this->id, |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | 'user' => new UserResource($this->user ?: (new User)->forceFill($this->anonymous())), |
42 | 42 | |
43 | 43 | 'permissions' => [ |
44 | - 'update' => $request->user()?->can('update', $this->resource), |
|
45 | - 'delete' => $request->user()?->can('delete', $this->resource) |
|
44 | + 'update' => $request->user() ? ->can('update', $this->resource), |
|
45 | + 'delete' => $request->user() ? ->can('delete', $this->resource) |
|
46 | 46 | ] |
47 | 47 | ] |
48 | 48 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'user' => new UserResource($this->user), |
44 | 44 | 'tags' => TagResource::collection($this->tags), |
45 | 45 | 'permissions' => [ |
46 | - 'update' => $request->user()?->can('update', $this->resource) |
|
46 | + 'update' => $request->user() ? ->can('update', $this->resource) |
|
47 | 47 | ], |
48 | 48 | |
49 | 49 | 'comments_count'=> $this->comments_count, |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | ]; |
60 | 60 | }), |
61 | 61 | |
62 | - 'is_voted' => $this->when($user, fn () => $this->voters->contains('user_id', $user->id), false), |
|
63 | - 'is_subscribed' => $this->when($user, fn () => $this->subscribers->contains('user_id', $user->id), false), |
|
64 | - 'comments' => $this->whenLoaded('commentsWithChildren', fn () => (new CommentCollection($this->commentsWithChildren))->setOwner($this->resource)), |
|
65 | - 'assets' => $this->whenLoaded('assets', fn () => AssetsResource::collection($this->assets), []), |
|
62 | + 'is_voted' => $this->when($user, fn() => $this->voters->contains('user_id', $user->id), false), |
|
63 | + 'is_subscribed' => $this->when($user, fn() => $this->subscribers->contains('user_id', $user->id), false), |
|
64 | + 'comments' => $this->whenLoaded('commentsWithChildren', fn() => (new CommentCollection($this->commentsWithChildren))->setOwner($this->resource)), |
|
65 | + 'assets' => $this->whenLoaded('assets', fn() => AssetsResource::collection($this->assets), []), |
|
66 | 66 | 'role' => $this->defaultRole() |
67 | 67 | ] |
68 | 68 | ); |