Akaunting/app/Models/Setting/Tax.php

52 lines
934 B
PHP
Raw Normal View History

2017-09-14 19:21:00 +00:00
<?php
namespace App\Models\Setting;
use App\Models\Model;
class Tax extends Model
{
protected $table = 'taxes';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'rate', 'enabled'];
/**
* Sortable columns.
*
* @var array
*/
public $sortable = ['name', 'rate', 'enabled'];
public function items()
{
return $this->hasMany('App\Models\Item\Item');
}
2017-10-15 22:06:49 +00:00
public function bill_items()
2017-09-14 19:21:00 +00:00
{
2017-10-15 22:06:49 +00:00
return $this->hasMany('App\Models\Expense\BillItem');
2017-09-14 19:21:00 +00:00
}
2017-10-15 22:06:49 +00:00
public function invoice_items()
2017-09-14 19:21:00 +00:00
{
2017-10-15 22:06:49 +00:00
return $this->hasMany('App\Models\Income\InvoiceItem');
2017-09-14 19:21:00 +00:00
}
2017-10-21 11:23:57 +00:00
/**
* Convert rate to double.
*
* @param string $value
* @return void
*/
public function setRateAttribute($value)
{
$this->attributes['rate'] = (double) $value;
}
2017-09-14 19:21:00 +00:00
}