Articles

Laravel 5 Collections: Removing Collection Elements With forget

Laravel 5 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...

Laravel 5 Collections: Retrieving a Portion of a Collection With slice

Laravel 5 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...

Laravel 5 Collections: Retrieving a Specified Number of Items From a Collection With take

Laravel 5 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...

Laravel 5 Collections: Retrieving and Removing an Element From a Collection With pull

Laravel 5 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...

Laravel 5 Collections: Retrieving Collection Element Values With pluck

Laravel 5 The pluck method is used to retrieve the a list of values from the collection. It defines two parameters: $value and $key. The $value indicates which property should become...