Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Illuminate\Database\Eloquent\Casts\Json if possible is Broken #248

Closed
frankyso opened this issue Dec 4, 2023 · 2 comments
Closed

Use Illuminate\Database\Eloquent\Casts\Json if possible is Broken #248

frankyso opened this issue Dec 4, 2023 · 2 comments

Comments

@frankyso
Copy link

frankyso commented Dec 4, 2023

Hi, just for information for this case, the setting that contains nested array, the lowest array casted as object and not array

https://github.com/spatie/laravel-settings/releases/tag/3.2.2

@frankyso frankyso changed the title Use Illuminate\Database\Eloquent\Casts\Json if possible Broken Use Illuminate\Database\Eloquent\Casts\Json if possible is Broken Dec 4, 2023
@tonning
Copy link

tonning commented Dec 4, 2023

First of, thank you for this great package.

This is a breaking change in our application too. We have instances where we would access the underlying values as an array, but this is now broken because those are returned as stdClass.

// Before 3.2.2
Astrogoat\Promobar\Settings\PromobarSettings {#4506 ▼
  -mapper: Spatie\LaravelSettings\SettingsMapper {#2351 ▶}
  -config: Spatie\LaravelSettings\SettingsConfig {[#4669 ▶](https://helixsleep.test/#sf-dump-521562539-ref24669)}
  -loaded: true
  -configInitialized: true
  #originalValues: Illuminate\Support\Collection {#4437 ▶}
  +payload: array:11 [▶]
  payload: array:11 [▼ // <-- Array
    "type" => "zaius"
    "button" => "<div><strong>VIEW OFFER*</strong></div>"
    "text_color" => "#ffffff"
    "padding_top" => "12"
    "content_mobile" => "<div>25% Off Sitewide + FREE Bundle! Ends 12/3</div>"
    "padding_bottom" => "12"
    "content_desktop" => "<div>🎁 Cyber Monday Sale! 25% OFF SITEWIDE + FREE Bundle With All Mattress Purchases ($330+ Value)! Offer Ends 12/3✨</div>"
    "background_color" => "#af295c"
    "zaius_content_id" => "2021__fourth_of_july__top_bar_pop_up_2021_-_fourth_of_july_-_top_bar_pop_up_2021_-_fourth_of_july_-_top_bar_pop_up_web_modal"
    "center_align_content" => true
    "countdown_timer_enabled" => false
  ]
  enabled: true
}
// After 3.2.2
Astrogoat\Promobar\Settings\PromobarSettings {#4506 ▼
  -mapper: Spatie\LaravelSettings\SettingsMapper {#2351 ▶}
  -config: Spatie\LaravelSettings\SettingsConfig {[#4669 ▶](https://helixsleep.test/#sf-dump-1046035305-ref24669)}
  -loaded: true
  -configInitialized: true
  #originalValues: Illuminate\Support\Collection {#4453 ▶}
  +payload: {[#4617 ▶](https://helixsleep.test/#sf-dump-1046035305-ref24617)}
  payload: {[#4617 ▼](https://helixsleep.test/#sf-dump-1046035305-ref24617) // <-- Now a stdClass
        +"type": "zaius"
        +"button": "<div><strong>VIEW OFFER*</strong></div>"
        +"text_color": "#ffffff"
        +"padding_top": "12"
        +"content_mobile": "<div>25% Off Sitewide + FREE Bundle! Ends 12/3</div>"
        +"padding_bottom": "12"
        +"content_desktop": "<div>🎁 Cyber Monday Sale! 25% OFF SITEWIDE + FREE Bundle With All Mattress Purchases ($330+ Value)! Offer Ends 12/3✨</div>"
        +"background_color": "#af295c"
        +"zaius_content_id": "2021__fourth_of_july__top_bar_pop_up_2021_-_fourth_of_july_-_top_bar_pop_up_2021_-_fourth_of_july_-_top_bar_pop_up_web_modal"
        +"center_align_content": true
        +"countdown_timer_enabled": false
      }
  enabled: true
}

Would it be possible to revert this change or make it an opt-in instead?

Thank you.

@rubenvanassche
Copy link
Member

Reverted with 3.2.3, maybe we'll add this in v4, we'll see when we get there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants