In Laravel 5.3, you'll find a new
method on all
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.