How to remove false and null items from Laravel collection

Categorized as Laravel Tagged

Here is the code which allows you remove all empty, null and false elements from you collection.

collect(['', null, false, 1, 2, 3])

// Returns [1, 2, 3]

Leave a reply

Your email address will not be published. Required fields are marked *