From 83ee07cca122dc8b6bd5452403d4a8dc13081f75 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 22 Nov 2023 11:14:04 +0000 Subject: [PATCH 1/2] Created mutator on category checkin_email Signed-off-by: snipe --- app/Models/Category.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/Models/Category.php b/app/Models/Category.php index c06ac3854..06d338a1c 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -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 "true"/"false" passed. + * + * @param $value + * @return void + */ + public function setCheckinEmailAttribute($value) + { + $this->attributes['checkin_email'] = (int) filter_var($value, FILTER_VALIDATE_BOOLEAN); + } + /** * ----------------------------------------------- * BEGIN QUERY SCOPES From d6a337a5842eafaf46181d6b9ebd6338c63d01fe Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 22 Nov 2023 11:23:17 +0000 Subject: [PATCH 2/2] English hard Signed-off-by: snipe --- app/Models/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Category.php b/app/Models/Category.php index 06d338a1c..d880ba899 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -257,7 +257,7 @@ class Category extends SnipeModel * 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 "true"/"false" passed. + * This will also correctly parse a 1/0 if "true"/"false" is passed. * * @param $value * @return void