bradders's avatar

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()])

0 likes
0 replies

Please or to participate in this conversation.