我想根据数据表的行中输入的数量创建行,所需结果为:2 * 2 = 4但我得到的结果为2 * 4 =8。请我需要帮助,在此先谢谢您。
HTML:
@foreach($detail_planning as $details)
<tr id='lignesPlanningType'>
<td hidden></td>
<td class='text-center text_vertical td_profil_total'>{{$details->libelle}} EX<input type='hidden' name='hidden_profil_total[]' class='hidden_profil_total' value='{{$details->total}}'><input type='hidden' name='hidden_id_profil[]' value='{{$details->id_profil}}'></td>
<td class='text-center text_vertical'><div class='row'><div class='col-md-6'><div class='input-group'><input type='text' onchange='calculer_somme_heure_lundi()' class='form-control timepicker timepicker-24 input_heure_de input_heure_lundi_de' name='input_heure_lundi_de[]' placeholder='hh:mm' value='{{$details->new_lundi_heure_de}}' title='Lundi de' readonly /><span class='input-group-btn'> <button class='btn default' type='button'><i class='fa fa-clock-o'></i></button></span></div></div><div class='col-md-6'><div class='input-group'><input type='text' onchange='calculer_somme_heure_lundi()' class='form-control timepicker timepicker-24 input_heure_a input_heure_lundi_a' name='input_heure_lundi_a[]' placeholder='hh:mm' value='{{$details->new_lundi_heure_a}}' title='Lundi a' readonly/><span class='input-group-btn'><button class='btn default' type='button'><i class='fa fa-clock-o'></i></button></span></div></div></div><input type='text' name='input_total_lundi[]' class='input_total_lundi input_total' value='' hidden>
<button type='button' class='btn blue-madison btn_ads btn_ads_lundi'>Affecter</button>
<input type='hidden' name='hidden_id_agent_lundi[]' class='hidden_global_id_agent_1 hidden_id_agent hidden_id_agent_lundi hidden_id_agent_lundi_1' />
<input type='hidden' name='hidden_id_agent_lundi[]' class='hidden_global_id_agent_2 hidden_id_agent hidden_id_agent_lundi hidden_id_agent_lundi_2' />
</td>
</tr>
@endforeach
My code laravel :
$input = Request::only('hidden_id_profil','table_input_profil','input_heure_lundi_de','input_heure_lundi_a');
for ($i=0; $i < count($input['hidden_id_profil']); ++$i)
{
for ($j=0; $j < count($input['hidden_id_agent_lundi'] ); ++$j)
{
$new_details_planning_programme = new PlanningAdsAffecte();
$new_details_planning_programme->id_planning_prestation = $id_planning_prestation;
$new_details_planning_programme->id_profil = $input['hidden_id_profil'][$i];
$new_details_planning_programme->lundi_heure_de = date('Y-m-d '.$input['hidden_hr_lundi_de_agent'][$j].':s');
$new_details_planning_programme->save();
}
}