spatie / laravel-settings

Store strongly typed application settings
MIT License
1.2k stars 110 forks source link

Use Illuminate\Database\Eloquent\Casts\Json if possible #241

Closed naxvog closed 9 months ago

naxvog commented 11 months ago

Tries to use Illuminate\Database\Eloquent\Casts\Json if it is available and falls back to native json_encode/json_decode otherwise.

This change allows the usage of custom JSON serializers or custom serialization options by defining the following in a service provider:

Json::encodeUsing(fn ($value) => json_encode($value, JSON_UNESCAPED_UNICODE));
rubenvanassche commented 9 months ago

Thanks!

rubenvanassche commented 9 months ago

Breaks a lot of cases, reverting