I have the following formula on my blade, and now I want to save the data for each row in my database. How to save this data in Laravel?
for ($i = 0; $i < 12; $i++){
var minhaData = moment(DataVencimento).add($i, 'months');
ParcelaVencimento = minhaData.format('DD/MM/YYYY');
var linha = '<tr class="selected" id="linha'+cont1+'"> <td> <button type="button" class="btn btn-warning" onclick="apagar('+cont1+');"> X </button></td> <td> <input type="hidden" name="cont1[]" value="'+cont1+'">'+cont1+'</td> <td> <input type="text" name="ParcelaVencimento[]" value="'+ParcelaVencimento+'"></td> <td> <input type="number" name="ParcelaValor[]" value="'+ParcelaValor+'"></td> </tr>'
cont1++;
}
I tried to do this in my Controller to save but this is returning the error "count (): Parameter must be an array or an object that implements Countable"
public function store(BoletoFormRequest $request){
$ParcelaVencimento=$request->get('ParcelaVencimento');
$ParcelaValor=$request->get('ParcelaValor');
$cont = 0;
while($cont < count($QtdParcela)){
$Boleto = new Boleto();
$Boleto->ParcelaVencimento=$ParcelaVencimento[$cont];
$Boleto->ParcelaValor=$ParcelaValor[$cont];
$Boleto->save();
$cont=$cont+1;
}
}
I'm a beginner, what's the best way to save this data?