Files
project/app/Models/Taxrate.php

32 lines
578 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Number;
class Taxrate extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'rate',
'active',
];
/**
* The attributes that are appended with attribute getters.
*
* @var string[]
*/
protected $appends = [
'rate_percentage',
];
public function getRatePercentageAttribute()
{
return Number::percentage($this->rate, 2, 8, 'de');
}
}