@@ -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 | ); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | parent::__construct(); |
15 | 15 | |
16 | - TagResource::urlResolver(fn (string $name) => route('guide.tag', [urlencode($name)])); |
|
16 | + TagResource::urlResolver(fn(string $name) => route('guide.tag', [urlencode($name)])); |
|
17 | 17 | |
18 | 18 | $this->breadcrumb->push('Rekrutacyjne Q&A', route('guide.home')); |
19 | 19 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | private function load() |
35 | 35 | { |
36 | 36 | if ($this->userId) { |
37 | - $userScope = fn ($builder) => $builder->where('user_id', $this->userId); |
|
37 | + $userScope = fn($builder) => $builder->where('user_id', $this->userId); |
|
38 | 38 | |
39 | 39 | $this->guideRepository->pushCriteria( |
40 | 40 | new EagerLoading([ |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function __construct(Auth $auth, TopicRepository $repository) |
42 | 42 | { |
43 | - TagResource::urlResolver(fn ($name) => route('forum.tag', [urlencode($name)])); |
|
43 | + TagResource::urlResolver(fn($name) => route('forum.tag', [urlencode($name)])); |
|
44 | 44 | |
45 | 45 | $this->repository = $repository; |
46 | 46 | $this->user = $auth->guard('api')->user(); |
@@ -395,7 +395,7 @@ |
||
395 | 395 | */ |
396 | 396 | public function commentsWithChildren() |
397 | 397 | { |
398 | - $userRelation = fn ($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed(); |
|
398 | + $userRelation = fn($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed(); |
|
399 | 399 | |
400 | 400 | return $this |
401 | 401 | ->comments() |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function commentsWithChildren() |
90 | 90 | { |
91 | - $userRelation = fn ($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed(); |
|
91 | + $userRelation = fn($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed(); |
|
92 | 92 | |
93 | 93 | return $this |
94 | 94 | ->comments() |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | - $this->load(['voters' => fn ($builder) => $builder->select(['id', 'guide_id', 'user_id'])->where('user_id', $userId)]); |
|
111 | + $this->load(['voters' => fn($builder) => $builder->select(['id', 'guide_id', 'user_id'])->where('user_id', $userId)]); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function loadUserRoleRelation(?int $userId): void |
@@ -117,6 +117,6 @@ discard block |
||
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | - $this->load(['roles' => fn ($builder) => $builder->select(['id', 'guide_id', 'role'])->where('user_id', $userId)]); |
|
120 | + $this->load(['roles' => fn($builder) => $builder->select(['id', 'guide_id', 'role'])->where('user_id', $userId)]); |
|
121 | 121 | } |
122 | 122 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | public static function url($model): string |
122 | 122 | { |
123 | - return match ($model::class) { |
|
123 | + return match($model::class) { |
|
124 | 124 | Guide::class => self::guide($model), |
125 | 125 | Job::class => self::job($model), |
126 | 126 | Topic::class => self::topic($model), |