Articles

Laravel 5 Collections: Checking If a Collection Contains Items With isEmpty

Laravel 5 The isEmpty can be used to determine if the collection has items or not. If the collection has no items, true will be returned, otherwise false will be returned. Signature public function isEmpty(); Example...

Laravel 5 Collections: Checking If a Collection Contains Items With isNotEmpty

Laravel 5 The isNotEmpty method is the logical opposite of the isEmpty method; and it will return a boolean indicating whether or not the collection is not empty. Signature public function isNotEmpty(); Example...

Laravel 5 Collections: Combining Collection Elements Into a String With implode

Laravel 5 The implode method will combine the items of the collection together. The Collection's implode method behaves differently than PHP's implode function in that it can operate on arrays of primitive data types as...

Laravel 5 Collections: Combining the Keys of a Collection With the Values of Another Collection With combine

Laravel 5 The combine method is used to combine the keys of the collection the method was called on with the values of another collection or array (supplied as an argument for $values). This method also returns a new...

Laravel 5 Collections: Combining the Values of Multiple Traversable Sources With concat

Laravel 5 The concat method will create a new collection by combining the values of the collection instance is called on with the provided $source. It is important to note that the source must implement the Traversable...