*/ use BelongsToSpace, HasFactory, HasUuids, SoftDeletes; protected $fillable = [ 'name', 'color', 'user_id', 'space_id', ]; /** * Hide the pivot from serialization so a Label looks identical whether it * is loaded standalone or through a belongsToMany relation. * * @var list */ protected $hidden = [ 'pivot', 'space_id', ]; /** @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class); } public function transactions(): BelongsToMany { return $this->belongsToMany(Transaction::class) ->using(LabelTransaction::class) ->withTimestamps(); } public function automationRules(): BelongsToMany { return $this->belongsToMany(AutomationRule::class, 'automation_rule_labels') ->using(AutomationRuleLabel::class); } }