How to remove false and null items from Laravel collection
Categorized as Laravel
Here is the code which allows you remove all empty, null and false elements from you collection.
collect(['', null, false, 1, 2, 3])
->filter()
->values();
// Returns [1, 2, 3]