*/ public function toArray(Request $request): array { if ($this->resource instanceof ProjectTemplate) { return [ 'id' => $this->id, 'project_id' => $this->project_id, 'source_project_id' => $this->source_project_id, 'source_project' => $this->relationLoaded('sourceProject') && $this->sourceProject !== null ? ProjectResource::make($this->sourceProject)->resolve() : null, 'name' => $this->name, 'slug' => $this->slug, 'is_published' => $this->is_published, 'copy_areas' => $this->copy_areas ?? [], 'configuration_snapshot' => $this->configuration_snapshot ?? [], 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } return [ 'id' => Arr::get($this->resource, 'id'), 'project_id' => Arr::get($this->resource, 'project_id'), 'source_project_id' => Arr::get($this->resource, 'source_project_id'), 'source_project' => Arr::get($this->resource, 'source_project'), 'name' => Arr::get($this->resource, 'name'), 'slug' => Arr::get($this->resource, 'slug'), 'is_published' => Arr::get($this->resource, 'is_published', true), 'copy_areas' => Arr::get($this->resource, 'copy_areas', []), 'configuration_snapshot' => Arr::get($this->resource, 'configuration_snapshot', []), 'created_at' => Arr::get($this->resource, 'created_at'), 'updated_at' => Arr::get($this->resource, 'updated_at'), ]; } }