Merge pull request #13922 from snipe/bug/sc-24097

Created mutator on category checkin_email
This commit is contained in:
snipe 2023-11-22 12:16:07 +00:00 committed by GitHub
commit 9c4fbbe915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,6 +247,26 @@ class Category extends SnipeModel
}
}
/**
* -----------------------------------------------
* BEGIN MUTATORS
* -----------------------------------------------
**/
/**
* This sets the checkin_value to a boolean 0 or 1. This accounts for forms or API calls that
* explicitly pass the checkin_email 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 setCheckinEmailAttribute($value)
{
$this->attributes['checkin_email'] = (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES