May 12, 2024
0
Level 1
Laravel Nova Repeater Text
Is it possible to use Nova Repeaters to repeat basic fields, like Text or URL?
I have a website column, of type JSON which has data structured like this: ["https://foo.com", "https://bar.com"]. I followed the docs and created a TextLine class to repeat:
// in my Nova Model Resource
public function fields(NovaRequest $request)
{
return [
Repeater::make("Website")->repeatables([TextLine::make()]),
];
}
//... TextLine Class
class TextLine extends Repeatable
{
public function fields(NovaRequest $request)
{
return [URL::make("Website")];
}
}
This works, but my JSON data is in a different structure to what I'd like:
[
{
"type": "text-line",
"fields": {
"website": "https://foo.com"
}
}
]
Is there any way to make something like this work? Repeater::make("Website")->repeatables([URL::make()])
Please or to participate in this conversation.