'integer', ]; protected static function boot(): void { parent::boot(); static::creating(function (self $tag) { if (empty($tag->slug)) { $tag->slug = str()->slug($tag->name); } }); } public function individui(): MorphToMany { return $this->morphedByMany(Individuo::class, 'taggable'); } public function gruppi(): MorphToMany { return $this->morphedByMany(Gruppo::class, 'taggable'); } public function eventi(): MorphToMany { return $this->morphedByMany(Evento::class, 'taggable'); } public function documenti(): MorphToMany { return $this->morphedByMany(Documento::class, 'taggable'); } public function mailingLists(): MorphToMany { return $this->morphedByMany(MailingList::class, 'taggable'); } public function getCountAttribute(): int { return $this->individui()->count() + $this->gruppi()->count() + $this->eventi()->count() + $this->documenti()->count() + $this->mailingLists()->count(); } }