Please can anyone assist in sending this dynamic values to database in laravel..I have tried the method i know, but i am not sure why i am not able to send it to the database
//This is the view
@foreach ($request as $item)
<tbody>
<tr>
<td class="idweek1"> <input type="text" id="idweek1" name="idweek1" class="form-control" value=""> </td>
<td><input type="text" id="marketers" name="marketers" class="form-control" value=""> </td>
<td><input type="text" id="amount" class="form-control" value=""> </td>
<!-- <td></td> -->
<td id="fundsforall" name="fundsforall" class="fundsforall"><input type="text" id="mar1id" class="form-control" value=""> </td>
</tr>
</tbody>
@endforeach
I have tried to use a for each loop to send but it returns a message that Invalid argument supplied for foreach()
Below is the foreach loop i have tried
//This is the loop in the controller..i am using a Post route
foreach ($request->idweek1 as $key => $value){
$str_explode = explode("|",$value);
$insert[] = [
'user_id' => $str_explode[1],
'amount' => $request->amount[$key]
];
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire