*/ public function toArray(Request $request): array { $data = [ 'id' => $this->id, 'title' => $this->title, 'extension' => $this->extension, 'download_url' => Storage::url($this->pathname), 'size' => $this->size, 'created_by' => $this->createdBy ? new UserProfileResource($this->createdBy) : null, 'created_at' => (string) $this->created_at, 'version' => $this->version, 'display_id'=>(string)$this->display_id, ]; if ($this->is_bim == 1 && $this->bimFile && $this->bimFile->convert_status == BimFileConvertStatus::DONE->value) { $data['model_preview'] = true; } return $data; } }