You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nova Flexible Content has a custom cast type which needs to be used in order for it to work properly. I believe this is not supported at this time.
The problem lies with saving the data. Every time the settings are saved any image filed within the flexible model will be set to null unless an image is selected every time.
\OptimistDigital\NovaSettings\NovaSettings::addSettingsFields([
Boolean::make('Use these slides on Homepage', 'use-on-homepage'),
Flexible::make('Slides', 'slides')
->addLayout('Image slide', 'image', [
Color::make('Background Color', 'bg-color')->compact(),
Image::make('Desktop Image', 'desktopimage')->rules('')->disk('public'),
// Avatar::make('Desktop Image', 'desktop-image')->rules('')->disk('public'),Image::make('Tablet Image (optional)', 'tablet-image')->disk('public')
->help('If left empty desktop image will be used as fallback.'),
Image::make('Mobile Image', 'mobile-image'),
Text::make('Alternative text', 'alttext')->rules('required'),
])
->button('Add slide'),
], [
'use-on-homepage' => 'boolean',
'slides' => FlexibleCast::class
// 'slides' => 'array',
// 'slides' => 'collection',
], 'Homepage');
I tried creating a custom Setting Model but this didn't work as it doesn't follow the Laravel standard casting.
I tried to implement a custom cast case inside getValueAttribute method, but again it didn't work.
I was hoping you could help me with finding a solution to my problem. I would appreciate any suggestions or direction.
Thanks
The text was updated successfully, but these errors were encountered:
Same problem here. The problem is occurring when I use an Image Field inside A Flexible Field inside the Nova Settings package. If I use in a model, works well. If I save for first time everything works correctly and the images are saved on the disk and in the json field. But If I let empty the Image field with a previous image saved, the field image is removed from the json of the Flexible content, both key and value.
I was trying to use Nova Flexible Content with nova settings.
Nova Flexible Content has a custom cast type which needs to be used in order for it to work properly. I believe this is not supported at this time.
The problem lies with saving the data. Every time the settings are saved any image filed within the flexible model will be set to null unless an image is selected every time.
I tried creating a custom Setting Model but this didn't work as it doesn't follow the Laravel standard casting.
I tried to implement a custom cast case inside getValueAttribute method, but again it didn't work.
I was hoping you could help me with finding a solution to my problem. I would appreciate any suggestions or direction.
Thanks
The text was updated successfully, but these errors were encountered: