mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Restoring older SnipeModel attribute setters
In case needed by API - needs investigation
This commit is contained in:
parent
ac83dba2bb
commit
0fb4ff77f4
|
@ -8,6 +8,15 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
class SnipeModel extends Model
|
||||
{
|
||||
// Setters that are appropriate across multiple models.
|
||||
public function setPurchaseDateAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['purchase_date'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
|
@ -22,6 +31,70 @@ class SnipeModel extends Model
|
|||
return;
|
||||
}
|
||||
|
||||
public function setLocationIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['location_id'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
public function setCategoryIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['category_id'] = $value;
|
||||
// dd($this->attributes);
|
||||
return;
|
||||
}
|
||||
|
||||
public function setSupplierIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['supplier_id'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
public function setDepreciationIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['depreciation_id'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
public function setManufacturerIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['manufacturer_id'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
public function setMinAmtAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['min_amt'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
public function setParentIdAttribute($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['parent_id'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public function getDisplayNameAttribute()
|
||||
|
|
Loading…
Reference in a new issue