'array' ]; public function user() { return $this->belongsTo('App\Models\Auth\User', 'user_id', 'id'); } public function dashboard() { return $this->belongsTo('App\Models\Common\Dashboard'); } public function widget() { return $this->belongsTo('App\Models\Common\Widget'); } public function getNameAttribute($value) { if ($value) { return $value; } return $this->widget->name; } public function getSettingsAttribute($value) { if (!empty($value)) { $value = json_decode($value, true); $value['widget'] = $this; } else { $value = [ 'widget' => $this ]; } return $value; } }