Skip to content
Advertisement

Save all record records using request->all in Laravel

Laravel provides a great help for developers to save all input fields of a form which is one record with one line of code.

like if I want to save a form which has multiple input fields and one record to database like:

enter image description here

then I can save it with below code and it works great:

JavaScript

Now I have a question. If I have multiple records (multiple rows) in a form and I can add new rows with a button pressed. Then how can I save all records with above code?

Like: enter image description here

Advertisement

Answer

The best answer for this question is using foreach statement. Like:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement