*/ public function toArray(Request $request): array { return [ 'number' => $this->number, 'title' => $this->title, 'url' => $this->html_url, 'labels' => $this->labels ?? [], 'is_good_first_issue' => $this->is_good_first_issue, 'is_help_wanted' => $this->is_help_wanted, // An issue someone has already claimed is not an invitation. 'is_available' => $this->isUnclaimed(), 'comments' => $this->comments, 'created_at' => $this->issue_created_at?->toIso8601String(), 'repository' => $this->whenLoaded('repository', fn () => [ 'full_name' => $this->repository->full_name, 'url' => $this->repository->html_url, 'primary_language' => $this->repository->primary_language, 'project' => $this->repository->relationLoaded('project') && $this->repository->project ? [ 'title' => $this->repository->project->getTranslation('title', app()->getLocale()), 'slug' => $this->repository->project->getTranslation('slug', app()->getLocale()), ] : null, ]), ]; } }