diff --git a/app/Models/Client.php b/app/Models/Client.php index 6d6dd0b4bc34..0949d4948f11 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -49,6 +49,13 @@ class Client extends EntityModel 'website', ]; + /** + * @var array + */ + protected $appends = [ + 'display_name', + ]; + /** * @var string */ @@ -331,6 +338,17 @@ class Client extends EntityModel return $contact->getDisplayName(); } + /** + * Making the virtual property display_name accessible + * via an accessor + * + * @return mixed|string + */ + public function getDisplayNameAttribute() + { + return $this->getDisplayName(); + } + /** * @return string */ diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 6273ce74e408..95a0cfaa5674 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -142,7 +142,7 @@ class Invoice extends EntityModel implements BalanceAffecting { return $this->is_recurring ? trans('texts.recurring') - : $this->invoice_number.' ('.$this->client->name.')'; + : $this->invoice_number.' ('.$this->client->display_name.')'; } /**