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: