How store Array using livewire?

how store Array of nested using livewire?

public $data=[
[
‘section_type’=>’’ ",
‘type’ =>’’ ",

]

];

You can use dot (.) or use forEach. It depends on your situation.

For example

public $data = ['abc', 'efg'];

for validation, you can use the following:

return [
 'data.abc' => 'required ...'
];

To store the data:

SomeModel::create([
'abc' => $this->data['abc'],
]);

And so on …

1 Like