mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Created mutator for requestable attribute
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
189c90e9e5
commit
3152df2c48
|
@ -921,6 +921,27 @@ class Asset extends Depreciable
|
||||||
return $cost;
|
return $cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -----------------------------------------------
|
||||||
|
* BEGIN MUTATORS
|
||||||
|
* -----------------------------------------------
|
||||||
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This sets the requestable to a boolean 0 or 1. This accounts for forms or API calls that
|
||||||
|
* explicitly pass the requestable field but it has a null or empty value.
|
||||||
|
*
|
||||||
|
* This will also correctly parse a 1/0 if "true"/"false" is passed.
|
||||||
|
*
|
||||||
|
* @param $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setRequestableAttribute($value)
|
||||||
|
{
|
||||||
|
$this->attributes['requestable'] = (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -----------------------------------------------
|
* -----------------------------------------------
|
||||||
* BEGIN QUERY SCOPES
|
* BEGIN QUERY SCOPES
|
||||||
|
|
Loading…
Reference in a new issue