'array', 'visibility_groups' => 'array', 'allowed_user_ids' => 'array', 'sort_order' => 'integer', 'is_active' => 'boolean', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; public function stabile(): BelongsTo { return $this->belongsTo(Stabile::class, 'stabile_id'); } public function parent(): BelongsTo { return $this->belongsTo(self::class, 'parent_id'); } public function children(): HasMany { return $this->hasMany(self::class, 'parent_id')->orderBy('sort_order')->orderBy('nome'); } public function documenti(): HasMany { return $this->hasMany(Documento::class, 'cartella_archivio_id'); } public function getDisplayPathAttribute(): string { $parts = array_filter([ trim((string) ($this->parent?->display_path ?? '')), trim((string) ($this->nome ?? '')), ]); return $parts === [] ? (string) ($this->nome ?? '') : implode(' / ', $parts); } }