When i am passing an associative array of data to controller its showing error that 'trying to get non-object property' my controller function is,
public function storeWBS(Request $request) {
foreach($request->all() as $value){
$formValue = new WorkBreakdownStructure;
$formValue->form_field_id = $value->idea_id;
$formValue->value = $value->wbs_description;
$formValue->save();
return back();}
}
i have set the variables 'fillable' in model
'id' ,'form_field_id' ,'value' if i print the '$formValue' with DD() i am getting the result
#parameters: array:4 [▼
"_token" => "u6iwKspevWLiuI6CRPhd82c8xm0EYb6IGQQJX2aR"
"idea_id" => array:3 [▼
0 => "1"
1 => "1"
2 => "1"
]
"wbs_description" => array:3 [▼
0 => "Work Breakdown Structure #1 :"
1 => "Work Breakdown Structure #2"
2 => "Work Breakdown Structure #3"
]
"percentage" => array:3 [▼
0 => "50"
1 => "12"
2 => "12"
]
]