Merge pull request #957 from codedge/#949-Improve-activity-stream-invoices

Show client name next to invoice no. on dashboard
This commit is contained in:
Hillel Coren 2016-07-20 11:54:17 +03:00 committed by GitHub
commit 61d3adecff
2 changed files with 21 additions and 1 deletions

View File

@ -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
*/

View File

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