Foreach error with repeater field

Hi, i have strange behaviour with a repeater field (never encountered before)
i have a simple repeater
Forms\Components\Repeater::make('links')
                    ->label('Links')   
                    ->maxItems(1)
                    ->addActionLabel('Add button')
                    ->schema([
                        Forms\Components\TextInput::make('url')
                            ->required()->url(),
                        Forms\Components\TextInput::make('text')
                            ->required(),
                    ]),

when i create a new item, it works
when i try to edit an exhisting item, populated with a seeder
i have the error 'foreach() argument must be of type array|object, string given'

the field is a longtext field, with cast as array (but if i change cast to json is the same)
in the database, it saved like this (new from form)
[{"url":"https:\/\/www.google.com","text":"test"}]


while the seeder save like this
"[{\"url\":\"https:\\\/\\\/www.google.com\",\"text\":\"test\"}]"
Solution
I would use an array in the seeder... you have the cast setup in your model?
Was this page helpful?