0

Hi I have 3 tables "temp_quotes", "quotes" and "quote_items"

Every quote generated goes to the "temp_quotes" table at first.

At the end of my multi-step form I need the following:

1- Receive all the quotes from the "temp_quotes" table, send it to the "quote_items" table and delete it from the "temp_quotes" table 2- Generate a new entry in the "quotes" table referencing the "users" table and the "quote_items" table

Here is all the data and how needs to be save/removed on the tables:

        temp_quotes Table
        ID            
        BRAND
        MODEL
        YEAR

        quotes Table:
        ID
        USER_ID
        QUOTE_ID

        quote_items Table:
        ID
        QUOTE_ID
        BRAND
        MODEL
        YEAR

Any help will be appreciated.

Alex
  • 79
  • 1
  • 11
  • 1
    `quotes Table: ID USER_ID QUOTE_ID` Please explain your thinking here? – Rijnhardt Mar 03 '16 at 09:28
  • At first I would recommend to make quotes table as: ID USER_ID BRAND MODEL YEAR As quote belongs to one user and there might not be one quote per a few users, right? – lifekent Mar 03 '16 at 09:34
  • Just to clarify, users go and fill a form. Data is sent to the temp_quotes table as it maybe more than one quote to be sent (Currently type of shopping cart). at the end the user fills some personal data and all the info is sent to the users table. So my idea is to associate the user with the quote sent and the quote with the quote items within. I hope it makes more sense – Alex Mar 03 '16 at 09:40
  • You should get to know the documentation better, there is nothing hard with making what you wrote. https://laravel.com/docs/5.1/eloquent-relationships – lifekent Mar 03 '16 at 09:47
  • I read the documentation but as I am starting with coding, some of the terms are sometimes not familiar. That is why a simple example will help me a lot. – Alex Mar 03 '16 at 09:49
  • My idea is to save all the quotes and quote items with an associated user id so when I try to receive the quotes I can get all the quotes items belonging to a quote and the quote belonging to the user. – Alex Mar 03 '16 at 10:03

0 Answers0