Articles

Laravel 5 Collections: Determining If a Collection Has An Element With has

Laravel 5 The has method is used to determine if a item exists in the collection based on a given $key. The has method returns true if the item exists and false if it does not. Signature public function has( ...

Laravel 5 Collections: Determining the Most Common Value in a Collection With mode

Laravel 5 In a data set, the mode is the value that appears most often. The mode method will return the mode of the data set contained within the collection; you may also specify a $key to narrow which data field the...

Laravel 5 Collections: Dumping the Collection Contents and Continuing Script Execution for Debugging With dump

Laravel 5 The dump method is similar to the dd method in that it is used to dump the contents of the collection to the output for debugging purposes, however, unlike the dd method, the dump method will not stop execution...

Laravel 5 Collections: Dumping the Collection Contents and Stopping Script Execution for Debugging With dd

Laravel 5 The dd method will dump the contents of the collection and stop execution of the script; in this way, it works just like the global dd helper function except that it acts exclusively on the collections internal...

Laravel 5 Collections: Ensuring a Collection Always Contains a Specified Number of Elements With pad

Laravel 5 The pad method will pad the current collection instance's elements up to the provided size with the given value (based on the integer size of the collection). This method will return a new collection instance...