added dataz attribute

pull/44/head
A1Gard 6 months ago
parent 991962ea43
commit 16c68954ce

@ -11,6 +11,10 @@ class Slider extends Model
use HasFactory,HasTranslations;
public $translatable = ['body'];
protected $casts = [
'dataz'
];
public function imgUrl()
{
if ($this->image == null) {
@ -24,4 +28,13 @@ class Slider extends Model
{
return $this->belongsTo(User::class);
}
public function getDatazAttribute(){
$result = [];
foreach (json_decode($this->data) as $item) {
$result[$item->key] = $item->value;
}
return $result;
}
}

Loading…
Cancel
Save