Showing 7 of 1,216 result(s)

/blog/2018/04/22/laravel-5-collections-removing-collection-elements-with-forget

The forget method removes an item from the collection based on given $key . The forget method returns a reference to the original collection, meaning it modifies the collection instance it was called on.The following code example demonstrates how...

/blog/2018/04/22/laravel-5-collections-removing-the-first-element-of-a-collection-with-shift

The shift method is used to remove the first item from the collection and return its value. The shift method modifies the collection instance. The shift method is similar in behavior to PHP's array_shift function.public function shift();The...

/blog/2018/04/22/laravel-5-collections-retrieving-a-portion-of-a-collection-with-slice

The slice method is used to return a slice, or portion of the collection starting at the given $offset . The $offset tells the slice method where to begin when creating the new collection. For example, if the $offset is 3 , the new collection will...

/blog/2018/04/22/laravel-5-collections-retrieving-a-specified-number-of-items-from-a-collection-with-take

The take method is a useful method that will return the provided number of items (up to the provided $limit ) from the collection. If the $limit is negative, it will return a number of items (up to the provided $limit ) from the end of the...

/blog/2018/04/22/laravel-5-collections-retrieving-a-subset-of-a-collections-elements-with-only

The only method is the logical opposite of the except method. The only method is used to return all the key/value pairs in the collection where the keys in the collection are in the supplied $keys array. If the argument supplied for $keys...

/blog/2018/04/22/laravel-5-collections-retrieving-and-removing-an-element-from-a-collection-with-pull

The pull method will remove an item from the collection whilst returning its value. If the item is not in the collection, the optional $default value will be returned. The pull method will modify the original collection.The following example...

/blog/2018/04/22/laravel-5-collections-retrieving-and-removing-the-last-collection-element-with-pop

The pop method is used to retrieve the last item from the collection while also removing it from the collection. If there are no items in the collection, the pop method will return null . The pop method modifies the collection instance it is...

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.