Search

Showing 7 of 1,216 result(s)

/blog/2018/04/22/laravel-5-collections-creating-a-copy-of-a-collection-with-tobase

The toBase method will return a new collection instance containing all of the data in the current collection instance. This can be useful for method chaining when you need to modify the collection's contents without changing the original...

/blog/2018/04/22/laravel-5-collections-creating-combination-of-elements-with-crossjoin

The crossJoin method is used to join the items within the collection instance with the values of the input arrays, or collections, with all possible permutations expressed. The final output of the crossJoin method will be a Cartesian product,...

/blog/2018/04/22/laravel-5-collections-determine-which-collection-elements-are-not-present-in-the-provided-collections-with-diff

The diff method is used to determine which items in the collection are not present in the supplied $items collection. $items can be be either an array, or another instance of Collection . The diff method returns a new instance of Collection .The...

/blog/2018/04/22/laravel-5-collections-determining-if-a-collection-contains-an-element-using-strict-comparison-with-containsstrict

The containsStrict method is similar to the contains method; it acts as a shortcut to calling the contains method with a strict comparison operator.The following examples demonstrate the behavior of the containsStrict method: After the above code...

/blog/2018/04/22/laravel-5-collections-determining-if-a-collection-contains-an-element-with-contains

The contains method is used to determine if a given $key exists within the collection. Additionally, an optional $value can be specified that will be used to check if a given key/value pair exists within the collection. The contains method is...

/blog/2018/04/22/laravel-5-collections-determining-if-a-collection-has-an-element-with-has

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.The following example demonstrates the usage of the has method:

/blog/2018/04/22/laravel-5-collections-determining-the-most-common-value-in-a-collection-with-mode

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 collection looks at when determining the...