Published On Aug. 8th 2016

What's New in Laravel 5.3: Toggle Pivot Table Records

Episode 8 Run Time 4:14

Download
In Laravel 5.3, you'll find a new toggle() method on all belongsToMany relationships. This solves the issue of needing to delete a pivot table record if it exists, or adding it if it doesn't. As an example, consider needing to toggle a user's "like" status for a post.