outl1ne / nova-simple-repeatable

A Laravel Nova simple repeatable rows field.
MIT License
73 stars 44 forks source link

Array to String Conversion #37

Closed jeremiahsherrill closed 2 years ago

jeremiahsherrill commented 2 years ago

I set up the field as json, but when I save I get Array to String Conversion

What am I missing

public function fields(Request $request)
{
    return [

        SimpleRepeatable::make('Vacation Days', 'vacation_days', [
            Text::make('Name', 'name')->sortable(),
            Date::make('Starting Date', 'starts_at'),
            Date::make('Ending Date', 'ends_at'),
        ])->canAddRows(true)->canDeleteRows(true)

    ];
}
Tarpsvo commented 2 years ago

You might have to add $casts = ['vacation_days' => 'array'] to your model.

jeremiahsherrill commented 2 years ago

duh.... yes, that is correct. I knew I was forgetting something. Thanks