Laravel Relationships Unlocked: Using belongsToMany, attach, and detach The many-to-many relationship is slightly more complicated than the relationships that we’ve looked at so far. For our example, we have a PersonalCar and that PersonalCar has images. If we looked at the inverse of it, the Image can have one or more PersonalCars. How do you store the relationship? Does PersonalCar need to have an image_id (foreign id) inside it and does Image also need a personal_car_id inside it? This is where the concept of pivot tables come in. It’s a table that stores the foreign id of each table. The Pivot Table Migration We have already looked at the pivot table migration when we