1 Answers
A:
To fill extra columns of a pivot table when adding a record in October CMS, you can use the ‘attach()’ or ‘sync()’ methods while specifying the additional pivot data. To do this follow the steps given below:
In your model, define the ‘belongsToMany’ relationship with ‘pivot’ attributes:
Use the ‘attach()’ method to add a record and fill the extra pivot columns:
You can use ‘sync()’ to update multiple records and their pivot data at once:
October CMS
OctoberDisclaimer
Techjockey’s software industry experts offer advice for educational and informational purposes only. A category or product query or issue posted, created, or compiled by Techjockey is not meant to replace your independent judgment.
20,000+ Software Listed
Best
Price Guaranteed
Free Expert
Consultation
2M+
Happy Customers