Take a look at pivot tables: http://laravel.com/docs/eloquent#working-with-pivot-tables
For many-to-many, calling detach with no arguments will detach all:
$category->subscribers()->detach();
You can also use sync to override the entire collection of models and replace it with an empty list:
$category->subscribers()->sync([]);
Both are covered in the docs on many-to-many, but it's very easy to miss a lot of the variants (I don't think that many people even know about sync, for example).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community