'date', 'status' => ClientStatus::class, ]; public function contacts(): BelongsToMany { return $this->belongsToMany(Contact::class) ->withPivot('is_primary'); } protected function primaryContact(): Attribute { return Attribute::get(fn () => $this->contacts()->wherePivot('is_primary', true)->first()); } public function invoices(): HasMany { return $this->hasMany(Invoice::class); } public function payments(): HasManyThrough { return $this->hasManyThrough(Payment::class, Invoice::class); } public function secondaryContacts(): BelongsToMany { return $this->belongsToMany(Contact::class) ->wherePivot('is_primary', false) ->withPivot('is_primary'); } }