Search

Showing 7 of 1,216 result(s)

/blog/2018/04/22/laravel-5-collections-dumping-the-collection-contents-and-continuing-script-execution-for-debugging-with-dump

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 of the script. Because of the...

/blog/2018/04/22/laravel-5-collections-dumping-the-collection-contents-and-stopping-script-execution-for-debugging-with-dd

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 array.In the following example, we...

/blog/2018/04/22/laravel-5-collections-ensuring-a-collection-always-contains-a-specified-number-of-elements-with-pad

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 without affecting the current...

/blog/2018/04/22/laravel-5-collections-excluding-collection-elements-with-except

The except method will return all the key/value pairs in the collection where the keys in the collection are not in the supplied $keys array. Internally, this method makes a call to the "Illuminate\Support\Arr:except($array, $keys)" helper...

/blog/2018/04/22/laravel-5-collections-execute-a-callback-on-the-collection-instance-while-returning-the-original-collection-instance-with-tap

The tap method will allow you supply a callback that will receive a copy of the current collection instance. The user supplied function will not modify the original collection, but will return a reference the original collection.In the following...

/blog/2018/04/22/laravel-5-collections-executing-a-function-on-a-collection-and-returning-the-function-results-with-pipe

The pipe method is similar to the tap method in that it executes the provided $callback function on a copy of the collection; however, unlike the tap method, the pipe method returns the result of the callback function.The following example...

/blog/2018/04/22/laravel-5-collections-executing-a-function-on-all-collection-elements-with-each

The each method accepts a $callback which will be called on each item in the collection. If the $callback returns false , the each method will break from its iterator and return a reference back to the original Collection instance. The callback...