What is a virtual field? Is this a field you are creating on the fly using the data saved in the model? If so, why don't you merge this data with array_merge after you gather the data from the model? Am I misunderstanding?
Nov 20, 2015
10
Level 5
Virtual fields, it is possible?
I have an underlying json field but I want to expose the individual json fields as virtual fields in the model, it is possible ?
I've create getters for my virtual fields, appended them in the $appends and created an ::saving event to try to create the json based on the individual values, but I can't get the values to build it with.
EDIT: If I include my virtual fields in the $fillable array I get the values, but then Eloquent push them to the underlying INSERT, giving me an obvious SQL error, there is no such column.
Any suggestions ?
Please or to participate in this conversation.