0
私は複数のフォームのデータを持つ配列の配列を持っています 私はDBに格納できるように各フォームのデータを1つの配列に分割したいです 現在laravelで配列の配列を対応する配列に分割したい5.2
public function storeWBS(Request $request)
{
$value = $request->all();
$formValue = new WorkBreakdownStructure;
$count = 0;
$data_array1 = array();
foreach ($value as $key => $val2) {
$data_array= $val2;
if (is_array($val2)) {
array_push($data_array1, $val2);
}
}
dd($value);
exit;
$data_array1->save();
}
し、この結果を取得するには、
array:4 [▼
"_token" => "bcK0e9z168ib7rbSZpoRPLWbhx3bRIHq1NqzfNeX"
"idea_id" => array:3 [▼
0 => "1"
1 => "1"
2 => "1"
]
"wbs_description" => array:3 [▼
0 => "Visit Campus to read about making great videos and more"
1 => "Visit Campus to read about \r\n"
2 => "Visit Campus to read about making great"
]
"percentage" => array:3 [▼
0 => "30"
1 => "30"
2 => "40"
]
]
私は1つのアレイ すなわち、
にあるように、内側の配列のインデックス0のすべての値を取得したいですI上から"idea_id"
=> "1"
"wbs_description"
=> "Visit Campus to read about making great videos and more"
"percentage"
=> "30"
は内側ループを実行しようとしたが、それは、同じ3つの配列で生じるだろう