title: Laravel attach with extra field
body: <p>I have 3 tables, <em>products</em>, <em>images</em> and <em>product_image</em>. The 3rd one is a pivoting table. Other than <em>product_id</em> and <em>image_id</em> in <em>product_image</em> table, I also have 2 extra fields in this pivoting table: <em>position</em> and <em>type</em>, now for an existing <em>product</em> model A, how do I attach an image to A and at the same time set up its <em>position</em> and <em>type</em> value in that pivoting record? Thanks.</p>