From 53272b033b995586a0d4bafcac9cdd374f75a931 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Thu, 27 Oct 2022 23:31:05 +0200 Subject: [PATCH] Set tags setter --- app/Models/Forms/Form.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php index c2f2405..d3a61d5 100644 --- a/app/Models/Forms/Form.php +++ b/app/Models/Forms/Form.php @@ -153,6 +153,14 @@ class Form extends Model $this->attributes['submitted_text'] = Purify::clean($value); } + public function setTagsAttribute($value) + { + if ($value == null || $value == '') { + $value = '[]'; + } + $this->attributes['tags'] = json_encode($value); + } + public function getIsClosedAttribute() { return ($this->closes_at && now()->gt($this->closes_at));