-
-
Notifications
You must be signed in to change notification settings - Fork 255
Open
Description
I want to save all images to one json column(custom_images),
But the following error is occurring.
Unable to parse incoming Flexible content, data should be an array. at /var/www/vhosts/4kvin.com/httpdocs/vendor/whitecube/nova-flexible-content/src/Flexible.php:409)
Car.php
public function image(): HasOne
{
return $this->hasOne(Image::class)->latestOfMany();
}
Image.php
protected $casts = [
'custom_images' => 'array',
];
public function car(): BelongsTo
{
return $this->belongsTo(Car::class);
}
CarResource.php
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
HasOne::make('Images', 'image', ImageResource::class),
];
}
ImageResource.php
public function fields(NovaRequest $request)
{
return [
Flexible::make('Images', 'custom_images')
->addLayout('Image', 'image', [
ImageField::make('Image')
->disk('custom_images')
->rules( 'image', 'max:2048')
->thumbnail(function ($value, $disk) {
return $value
? Storage::disk($disk)->url($value)
: null;
})
])->button('Add Image'),
];
}
Laravel 10.10
Nova 4.35
nova-flexible-content 1.1.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels