Laravel - Collections - Method Except

The except method returns all items in the collection except for those with the specified keys:

    
    $collection = collect(['product_id' => 1, 'price' => 100, 'discount' => false]);
    
    $filtered = $collection->except(['price', 'discount']);
    
    $filtered->all();
    
    // ['product_id' => 1]
	

For the inverse of except, see the only method.

This method's behavior is modified when using Eloquent Collections.