In my model defined images
field as jsonable
:
protected $jsonable = ['images'];
I have like this field in my model fields.yml
file:
images:
label: 'Images'
prompt: 'Add image'
maxItems: '1'
span: left
containerAttributes:
items: '1'
type: repeater
tab: 'Images'
form:
fields:
img_big:
label: 'Big image'
mode: image
span: auto
type: mediafinder
img_mini:
label: 'Mini image'
mode: image
span: auto
type: mediafinder
alt:
label: 'Image Alt'
span: left
type: text
title:
label: 'Image Title'
span: right
type: text
The example above works great. But now I have changed the structure of the database by adding a new table for images to separate them.
Tables:
- images
- imageables
Then inside my model defined relation for images:
public $morphToMany = [
'images' => [
Image::class,
'table' => 'my_plugin_imageables',
'name' => 'imageable'
]
];
In this case how I can create correctly repeater field with form behaviors when images has morph to many relationship?