2

I'm very new to Laravel. Just getting around the MVC idea.

How would I go about writing in Laravel so I can insert / update multiple rows into my database? For one entry, correct me if I'm wrong, I can write my form in a View, which the content are shown based on my Controller 'create function' (e.g. where to gather data to input into my Select form input), it then checks my data in the Model and returns it to my Controller 'store' and saves it.

How does the data get passed to the database in the store function? How would I go about writing a form (same content - e.g. project_detail, project_name, project_price ) three or fours times, on one page. How do I pass the arrays so each array gets entered as a new row?

1
  • So there are a number of way to do what you want to do. Can you provide your attempts in code that you have already tried? Also, If you include your goal (what you want to happen) as well as your question, sometimes it makes it easier to give you an answer. Commented Jun 9, 2015 at 2:49

1 Answer 1

1

I think you're trying to create a shopping cart type functionality.

You can just create a single form to add items. then create a table that would list the items you've added. you can use ajax to submit your form. then store the items in a session. or you can use shopping car package. then display the added items to your view.

hope this gives you a little idea how to go about with your project.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes your right after storing data into session you can proceed insert batch operation so it is easy to insert.right..?
Yup. you're correct. so when you're done selecting items. then you post or batch submit it. you loop through your items and save it one by one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.