Simple repeater data passing in as string instead of array

I'm being thrown for a loop by what I thought were pretty basic repeaters. I've got two simple repeaters in my form: functions & qualifications.

They look like this in the migration:
$table->json('functions')->nullable();
$table->json('qualifications')->nullable();

the form fields are defined as:
Section::make()
  ->columnSpanFull()
  ->schema([
    Repeater::make('functions')
      ->label('Job Functions')
      ->addActionLabel('Add job function')
      ->simple(
        TextInput::make('function')
      ),
    ]),

Section::make()
  ->columnSpanFull()
  ->schema([
    Repeater::make('qualifications')
      ->label('Qualifications')
      ->addActionLabel('Add qualification')
      ->simple(
        TextInput::make('qualification')
      ),
    ]),

and I have casts in the model:
protected $casts = [
    'functions'       => 'array',
    'qualifications'  => 'array',
];

When I initially add the record - or if I manually set them to NULL and then edit it - I can add items to the repeater. What gets stored in the database is
"[\"Lorem ipsum dolor sit amet.\",\"Stet clita kasd gubergren, no sea takimata sanctus est.\"]"

including the surrounding quotes. But if I edit a record that has any data in the field(s), I get the following error:
foreach() argument must be of type array|object, string given at /var/www/html/vendor/filament/forms/src/Components/Repeater.php:783)


I've been up and down the Repeater docs page numerous times and I'm not seeing anything that looks out of place. Am I missing something? Any idea what I'm doing wrong?

Thanks.
Was this page helpful?