added attribute casting
This commit is contained in:
@@ -19,6 +19,15 @@ class Category extends Model
|
||||
*/
|
||||
protected $fillable = ['company_id', 'name', 'type', 'color', 'enabled'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Sortable columns.
|
||||
*
|
||||
|
@@ -20,6 +20,16 @@ class Currency extends Model
|
||||
*/
|
||||
protected $fillable = ['company_id', 'name', 'code', 'rate', 'enabled', 'precision', 'symbol', 'symbol_first', 'decimal_mark', 'thousands_separator'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'rate' => 'double',
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Sortable columns.
|
||||
*
|
||||
@@ -72,17 +82,6 @@ class Currency extends Model
|
||||
return $this->contacts()->whereIn('type', (array) $this->getVendorTypes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert rate to double.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setRateAttribute($value)
|
||||
{
|
||||
$this->attributes['rate'] = (double) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current precision.
|
||||
*
|
||||
|
@@ -25,6 +25,16 @@ class Tax extends Model
|
||||
*/
|
||||
protected $fillable = ['company_id', 'name', 'rate', 'type', 'enabled'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'rate' => 'double',
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Sortable columns.
|
||||
*
|
||||
@@ -101,17 +111,6 @@ class Tax extends Model
|
||||
return $query->where($this->table . '.type', '<>', 'withholding');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert rate to double.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setRateAttribute($value)
|
||||
{
|
||||
$this->attributes['rate'] = (double) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name including rate.
|
||||
*
|
||||
|
Reference in New Issue
Block a user