waleed
waleed

Reputation: 51

how to save records in pivot table after checking the records in pivot table for duplication in laravel

I have a products table and pivot table product collection. Now i want to save only the records in the pivot table that does,t contains any duplicate entry in pivot table from product table .

Upvotes: 0

Views: 26

Answers (1)

Munna Khan
Munna Khan

Reputation: 2052

You cab use sync() method to avoid duplicate entry. This method will remove the old records that doesn't exits in form data and it add new rows if the form data have new values.

Upvotes: 1

Related Questions