belongsToMany(User::class, 'cost_unit_treasurers', 'cost_unit_id', 'user_id') ->withTimestamps(); } public function resetTreasurers() { $this->treasurers()->detach(); $this->save(); } public function invoices() : hasMany { return $this->hasMany(Invoice::class); } public function tenant() : BelongsTo { return $this->belongsTo(Tenant::class, 'tenant', 'slug'); } }