*/ public function toArray(Request $request): array { $shown = [ 'id' => $this->id, 'type' => $this->type, 'subject_id' => $this->subject_id, 'reason' => $this->reason, 'read_at' => $this->read_at?->toIso8601ZuluString(), 'created_at' => $this->created_at->toIso8601ZuluString(), 'actor' => ProfileResource::make($this->actor), 'actors' => ProfileResource::collection($this->whenLoaded('actors')), 'organization' => $this->organization instanceof Organization ? OrganizationResource::make($this->organization) : null, 'group_id' => $this->group_id, 'event_count' => $this->event_count, 'actors_count' => $this->actors_count, 'unread_count' => $this->unread_count, 'commit' => $this->commit instanceof Commit ? CommitResource::make($this->commit) : null, ...$this->type === NotificationType::TimedOut && $this->timeout instanceof UserTimeout ? ['timeout' => [ 'reason' => $this->timeout->reason->label(), 'duration' => $this->timeout->duration(), 'ends_at' => $this->timeout->ends_at->toIso8601ZuluString(), ]] : [], ]; return $this->withGuildMentions ? ShownGuildMentions::of($shown, $request->user()) : $shown; } }