I'm currently working on a "custom fields" feature for my Laravel-app.
CustomField should be editable by the user. The
CustomField can have a
int, ...) and a
Now the created
CustomFields can be added to another model (Maybe:
The values of the custom fields should be callable using something like
It should be easy to iterate through the fields like this:
I'm not sure which way to go: Of course I could just create a model called
CustomField and a table with
and save them to the
User as JSON ($user->fields would be type
JSON). But I am not sure, whether this is the best way to go, because I also would like to make the fields searchable later. So maybe
pivot is the way to go? Or even
Which way is the most "Laravel-style" way to go?
Thank you for your thoughts (and maybe 1-2 examples ;-) )