currency symbol added to account name
This commit is contained in:
@@ -18,7 +18,7 @@ class Account extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = ['balance'];
|
||||
protected $appends = ['balance', 'title'];
|
||||
|
||||
/**
|
||||
* Attributes that should be mass-assignable.
|
||||
@@ -89,6 +89,20 @@ class Account extends Model
|
||||
->select(['accounts.*', 'accounts.opening_balance as balance']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name with currency.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleAttribute()
|
||||
{
|
||||
if ($this->currency->symbol) {
|
||||
return $this->name . ' (' . $this->currency->symbol . ')';
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current balance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user