Fix removed properties casting

This commit is contained in:
Julien Nahum 2023-10-13 11:43:53 +02:00
parent 2ab3f79801
commit f0939f3992
2 changed files with 9 additions and 5 deletions

View File

@ -15,6 +15,7 @@ use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions; use Spatie\Sluggable\SlugOptions;
use Stevebauman\Purify\Facades\Purify; use Stevebauman\Purify\Facades\Purify;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Casts\Attribute;
class Form extends Model class Form extends Model
{ {
@ -218,9 +219,12 @@ class Form extends Model
return !empty($this->password); return !empty($this->password);
} }
public function getRemovedPropertiesAttribute() protected function removedProperties(): Attribute {
{ return Attribute::make(
return $this->attributes['removed_properties'] ?? []; get: function ($value) {
return $value ? json_decode($value, true) : [];
}
);
} }
/** /**