How to remove a polymorphic relation in Eloquent?

to reomove from pivot table in many to many polymorphic relation just use detach:

$posts->photos($photoModel)->detach();

$posts->photos() is the relationship query to return all of the photos for a post. If you call delete() on that, it will delete all of those records. If you only want to delete a specific record, you need to make sure you only call delete on the one you want to delete. For example:

$posts->photos()->where('id', '=', 1)->delete();