[Request] MySQL/Postgres JSON Field Support
With Laravel's support for updating JSON fields, it would be great if Nova supported defining resource fields for data within a JSON column field (not just a code editor). Maybe a new JSON field type could accept an array mapping each JSON field key to an existing Nova field type. The JSON field could default to displaying as a separate Nova field panel.
Example (not sure if it's valid, but just an idea):
JSON::make('Options')->json(
[
'price' => Text::make('Price'),
'color' => Select::make('Color')->options( \App\Color::getColors() )
]
)
We were actually talking about implementing something like this today for one of our projects that has a flexible JSON field. 👍
There is a package that does this already
https://novapackages.com/packages/fourstacks/nova-repeatable-fields
Is there anything like this except for relations? For example, my pet store contains a hasMany relation with pets. I can add x amount of pets to the store. Basically repeatable fields but with relations instead of a JSON payload that saves to a particular field. This would be extremely useful.
In case you are interested we just released a package for this. Take a look. Issues and PRs welcome!
https://novapackages.com/packages/64robots/nova-json
I think this should be handled by Nova instead of contrib packages.
I try to add field options with array of object style
let simple = [
{name: "size", values: ["sm", "md", "lg"]},
{name: "fabric", values: ["cotton", "silk", "linen"]}
]
let nested = [
{name: "color", values: [{ value: "#FF0000", label: 'Red' }, { value: "blue", label: "Blue" }, { value: "green": label: "Green" }]}
]
All contrib packages do not work, summary below:
| Feature | nsavinov/nova-json-schema-field |
fourstacks/nova-repeatable-fields |
64robots/nova-json |
|---|---|---|---|
| Nova native field | 👍 | ||
| Array of object | 👍 | ||
| JSON schema | 👍 | ||
| Nested object |
Hey there! In order to keep this repository focused on bug reports, we auto-close feature requests and requests for help. Feel free to post your feature requests so others can discuss and add reactions. We'll keep an eye on them for later planning.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.