Search

Showing 7 of 1,216 result(s)

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

The following examples are trivial use cases of the each method in that we iterate each element of the collection and echo the element: The each method does not explicitly allow the modification of a collection's items, and simply returns a...

/blog/2018/04/22/laravel-5-collections-executing-a-function-on-all-collection-elements-with-each#content-using-each-with-higher-order-messages

The each method can also be used with higher order messaging, which allows us to invoke collection methods and access properties on objects using PHP's property accessors syntax. In the following example, we will create modify our User class to...

/blog/2018/04/22/laravel-5-collections-executing-a-function-on-collection-elements-and-values-with-mapspread#content-signature

The following example demonstrates the basic use of the mapSpread method. We will first create a series of numbers using PHP's range function; afterwards, we will split the collection into smaller pieces using the chunk method and then label each...

/blog/2018/04/22/laravel-5-collections-executing-a-function-on-collection-elements-and-values-with-mapspread#content-replicating-the-behavior-of-the-linq-zip-operator

We can use the mapSpread method to replicate the behavior of LINQ's Zip operator that was added in version 4 of the .NET Framework. LINQ's Zip operator enumerates two collections and allows a new collection to be created by executing a function...

/blog/2018/04/22/laravel-5-collections-filtering-collection-elements-with-filter#content-signature

The following examples demonstrate the behavior of the filter method; the results of the filtering process will appear above the method invocation as a comment:

/blog/2018/04/22/laravel-5-collections-filtering-collection-elements-with-filter#content-using-filter-with-higher-order-messages

The filter method can also be used with higher order messaging, which allows us to invoke collection methods and access object instance properties using PHP's property accessors syntax. In the reject section, we implemented a Product class that...

/blog/2018/04/22/laravel-5-collections-filtering-collections-with-without-losing-filtered-rejections-partition#content-signature

The following is a trivial example of the partition where we create two partitions, one containing the vowels of a sentence and the other containing the consonants of the sentence. We will then take the results of the partition method and pass...

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.