1
I have the following formula in my Blade, and now I want to save the data of 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 getting back 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 am beginner, which is the best method to save this data?