belongsTo(Category::class); } public function customFields(): BelongsToMany { return $this->belongsToMany(CustomField::class, 'custom_field_subcategory') ->withPivot('position') ->orderBy('custom_field_subcategory.position'); } public function teams(): BelongsToMany { return $this->belongsToMany(Team::class, 'team_subcategory'); } public function tickets(): HasMany { return $this->hasMany(Ticket::class); } public function label(): string { return $this->category->name.' / '.$this->name; } }