1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Create virtual display_name field on client

- Create virtual display_name field on client
- Create accessor for it
This commit is contained in:
Holger Lösken 2016-07-06 19:42:36 +02:00
parent f091cbd060
commit 42c51ea94a
2 changed files with 19 additions and 1 deletions

View File

@ -49,6 +49,13 @@ class Client extends EntityModel
'website', 'website',
]; ];
/**
* @var array
*/
protected $appends = [
'display_name',
];
/** /**
* @var string * @var string
*/ */
@ -331,6 +338,17 @@ class Client extends EntityModel
return $contact->getDisplayName(); return $contact->getDisplayName();
} }
/**
* Making the virtual property display_name accessible
* via an accessor
*
* @return mixed|string
*/
public function getDisplayNameAttribute()
{
return $this->getDisplayName();
}
/** /**
* @return string * @return string
*/ */

View File

@ -142,7 +142,7 @@ class Invoice extends EntityModel implements BalanceAffecting
{ {
return $this->is_recurring return $this->is_recurring
? trans('texts.recurring') ? trans('texts.recurring')
: $this->invoice_number.' ('.$this->client->name.')'; : $this->invoice_number.' ('.$this->client->display_name.')';
} }
/** /**