I'm having a question regarding retrieving information from an html table and saving it to the database using laravel.
This part of the application consists of storing information related to the tests that this user is supposed to perform in a user_exame table.
In the table I store user_id, examen_id, dt_utlimo_exame, dt_proximo_exame
I'm populating the html table with the following code:
eventsForm: function(){
jQuery('#btn-adicionar-exame').click(function(){
moment.locale('pt-br');
var id = jQuery('#exame').find('option:selected').val();
var exame = jQuery('#exame').find('option:selected').text();
var periodical = jQuery('#periodical').find('option:selected').val();
var periodicalText = jQuery('#periodical').find('option:selected').text();
var ultimoExame = jQuery('#dtUltimoExame').val();
var newRow = $("<tr>");
var cols = "";
var proximoExame = '';
//Define a proxima data do exame
proximoExame = moment(ultimoExame, "DD/MM/YYYY").add(periodical, 'months');
cols += '<td>' + id + '</td>';
cols += '<td>' + exame + '</td>';
cols += '<td>' + periodicalText + '</td>';
cols += '<td>' + ultimoExame + '</td>';
cols += '<td>' + moment(proximoExame, "DD/MM/YYYY").calendar() + '</td>';
cols += '<td>';
cols += '<button type="button" class="btn btn-link " id="btn-delet" onclick="employee.removeTableRow(this)"><i class="fa fa-trash fa-1x color-red"></i></button>';
cols += '</td>';
newRow.append(cols);
/Adicionando a row a tabela
jQuery("#table-list-exames").append(newRow);
//Limpando os campos
jQuery('#exame').val("").change();
jQuery('#periodical').val("").change();
jQuery('#dtUltimoExame').val('');
});
},
My question is: how to retrieve each row of the table and store it in the database using Laravel?
I know that in javascript I could do something like:
tableExames.find('tr').each(function (i) {...}
But how to do this in the Laravel controller?