closes #281
This commit is contained in:
@ -9,6 +9,13 @@ class Tax extends Model
|
||||
|
||||
protected $table = 'taxes';
|
||||
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = ['title'];
|
||||
|
||||
/**
|
||||
* Attributes that should be mass-assignable.
|
||||
*
|
||||
@ -48,4 +55,24 @@ class Tax extends Model
|
||||
{
|
||||
$this->attributes['rate'] = (double) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name including rate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleAttribute()
|
||||
{
|
||||
$title = $this->name . ' (';
|
||||
|
||||
if (setting('general.percent_position', 'after') == 'after') {
|
||||
$title .= $this->rate . '%';
|
||||
} else {
|
||||
$title .= '%' . $this->rate;
|
||||
}
|
||||
|
||||
$title .= ')';
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user