Laravel: Pivot Table, ManytoMany

  laravel, pivot, relationship

I have been stuck on this since May 2020. I don’t know how to move forward with the project. Any link or guidance would be very much appreciated. I’m trying to create a very simple rental system.

I have a Customer table: id, Name, Barcode
Another one is Item table: id, Name, Barcode, OnLoan

I’m trying to create a Form where there is a search box for Customer and search box for the Items. When the customer barcode is found and item barcode is found, you can fill in the Date Loaned and Date Due and click submit.

In the Item table, the OnLoan needs to be set to 1.

How do we do this please? Any link or keywords to help me on my way would be really great.

I have been googling and found out about onetomany, manytomany, pivot, scope, repositories. It’s very overwhelming, i’m trying to go over them one at a time.

Source: Laravel

Leave a Reply