attributes['meta_value'] = $value; } public function getMetaValueAttribute( $value ) { if (is_string( $value )) { $decoded = json_decode($value, true); return $decoded ?: $value; } return $value; } public function product_detail() { return $this->belongsTo( Subscription::class, 'subscription_id', 'id' ); } }