laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

configuration option for date serialization #2496

Open danikp opened 3 years ago

danikp commented 3 years ago

While upgrading project from larave 6 to 8 faced issue with data format change while serialized to array/json. That change documented in upgrade guide https://laravel.com/docs/7.x/upgrade#date-serialization, but proposed solution means going over 200+ models and adding that code to each one of them or extending base model with our custom and extending it from each and every model or using trait and still adding it to each and every model. Too many files to update.

Likely for us, we had trait used in almost all models and we added that part there, which solved that issue in short term. But better solution for us and everybody who will need to go over that upgrade path too is to add configuration option to set default serialization format (default to ISO-8601 ) or having single place there we can set that function on framewok level, without need to touch all model files.