*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'object_type' => $this->object_type, 'object_id' => $this->object_id, 'name' => $this->name, 'parent_id' => $this->parent_id, 'sequence' => $this->sequence, 'created_at' => (string)$this->created_at, 'updated_at' => (string)$this->updated_at, 'created_by' => $this->createdBy ? new UserProfileResource($this->createdBy) : null, 'updated_by' => $this->updatedBy ? new UserProfileResource($this->updatedBy) : null, 'type' => 'folder', 'itemCount' => $this->children()->count() + $this->files()->where('is_latest_version', 1)->count(), 'uniId' => 'folder_' . $this->id, 'display_id'=>(string)$this->display_id, 'naming_rule' => new NamingRuleSimpleResource($this->namingRule), ]; } }