Comments (4)
@Naoray you're right. I forgot to add that you need to get the property 'data' from the top JSON field.
Like this:
- don't wrap JSON::make() in [] so it would look like this:
Panel::make('Brand Settings',
JSON::make('brand_settings', [
Image::make('Logo')->disk('public'),
Color::make('Primary Color')->swatches(),
Color::make('Secondary Color')->swatches(),
])->data,
),
- if you need other fields inside the Panel you can use splat operator like this:
Panel::make('Brand Settings', [
Text::make('Field'),
...JSON::make('brand_settings', [
Image::make('Logo')->disk('public'),
Color::make('Primary Color')->swatches(),
Color::make('Secondary Color')->swatches(),
])->data,
]),
from nova-json.
@elijahworkz thanks. That works 🤝
from nova-json.
There are a couple of way to solve this without changing the code
- don't wrap JSON::make() in [] so it would look like this:
Panel::make('Brand Settings',
JSON::make('brand_settings', [
Image::make('Logo')->disk('public'),
Color::make('Primary Color')->swatches(),
Color::make('Secondary Color')->swatches(),
]),
),
- if you need other fields inside the Panel you can use splat operator like this:
Panel::make('Brand Settings', [
Text::make('Field'),
...JSON::make('brand_settings', [
Image::make('Logo')->disk('public'),
Color::make('Primary Color')->swatches(),
Color::make('Secondary Color')->swatches(),
]),
]),
added section to readme.md #4
from nova-json.
@elijahworkz I tested both approaches and none of them worked. First approach did throw errors related to the fact that the JSON
class does not inherit from Field
. Second approach is not possible because you can't deconstruct associative arrays with ...
from nova-json.
Related Issues (8)
- Difference to the other packages? HOT 4
- Package not working with Nova ^4.0 and Laravel 9 HOT 3
- Not compatible with laravel <8 HOT 1
- Unexpected bool (T_STRING) JSON.php while loading Form view HOT 6
- Nested resources don't get the JSON prefix
- Wrapped fields hidden with Nova Flexible Content HOT 5
- Nova 4 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nova-json.