webseite funktioniert, pay sdk, blog backend funktioniert
This commit is contained in:
@@ -40,7 +40,32 @@ class Package extends Model
|
||||
'features' => 'array',
|
||||
];
|
||||
|
||||
// features handled by $casts = ['features' => 'array']
|
||||
|
||||
protected function features(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function ($value) {
|
||||
if (is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
$decoded = json_decode($value, true);
|
||||
|
||||
if (is_string($decoded)) {
|
||||
$decoded = json_decode($decoded, true);
|
||||
}
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
|
||||
return $decoded;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function eventPackages(): HasMany
|
||||
{
|
||||
@@ -77,4 +102,4 @@ class Package extends Model
|
||||
'max_events_per_year' => $this->max_events_per_year,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user