I'm using jquery nested form repeater. When I submit form I get these values.
Illuminate\Http\Request {#51 ▼
+request: Symfony\Component\HttpFoundation\ParameterBag {#52 ▼
#parameters: array:22 [▼
"_token" => "brgVhd3F1K0wWqxsjDn6Vf9gBdKLX8CO8XbpkBJJ"
"options" => array:2 [▼
0 => array:4 [▼
"name" => "Color"
"type" => "dropdown"
"is_required" => array:1 [▶]
"values" => array:1 [▼
0 => array:3 [▼
"label" => "Red"
"price" => "100"
"price_type" => "fixed"
]
]
]
1 => array:3 [▼
"name" => "Size"
"type" => "dropdown"
"values" => array:1 [▼
0 => array:3 [▼
"label" => "s"
"price" => "100"
"price_type" => "percent"
]
]
]
]
]
}
}
I have tried using this. But it's give me Trying to get property 'name' of non-object;
foreach ($request->input('options') as $option) {
Option::create([
'name' => $option->name,
'type' => $option->type,
'is_required' => (boolean) $option->is_required
]);
$option->values()->createMany($request->input('options.*.values'));
}
How can I access values?
Please help me to solve this problem.
Thanks.
dd($request->all());.