I've had a look at serialization after the model is loaded from the database using protected $casts, but we have a slightly different situation. What I'm trying to figure out is how to use serialize() function to save model' attributes instead of json_encode and not having much luck. Using accessors does not work since it's only for the accessing the data, not for doing post-load-from-database conversion. Are there any examples of how this can be done? The only one I can think of is the subscription to the event, but this is going to be messy.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire