Laravel Eloquent Auto Delete problem

Model

class Category extends Model
{
    public $belongsToMany = [
        'products' => [
            'pms\Models\Product',
            'table' => 'pms_product_category'
        ],
    ];
}

Controller:

$category = Category::whereRaw("REPLACE(name,' ','-') = '{$categoryname}'")->first();

//This line will delete product relation table of this category
//Unknown reason.
$category->products = [];