Dear Sarthak sir
Please explain the three sync attach and toggle difference ...
Sarthak Shrivastava replied 1 year ago
sync and attach are used to associate many-to-many relationships.
sync accept IDs of table you want to associate and any IDs that are not in the given array will be removed from the intermediate table.
Toggle means if true then make it false, and if false then make it true.
It Just turn the last state.
So in the many-to-many relationship also provides a toggle method which "toggles" the attachment status of the given IDs. If the given ID is currently attached, it will be detached. Likewise, if it is currently detached, it will be attached.