Laravel - Collections - Method Diff

The diff method compares the collection against another collection or a plain PHP array based on its values. This method will return the values in the original collection that are not present in the given collection:

    
    $collection = collect([1, 2, 3, 4, 5]);
    
    $diff = $collection->diff([2, 4, 6, 8]);
    
    $diff->all();
    
    // [1, 3, 5]
	
This method's behavior is modified when using Eloquent Collections.