Showing 7 of 1,216 result(s)
keyBy($keyBy) The keyBy method is used to create a new Collection instance where the keys of the new key/value pairs are determined by a $keyBy callback function (a string value can also be supplied instead of a function). The signature of the...
only($keys) 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. Internally, this method makes a...
pluck($value, $key = null) 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 the value in the resulting collection and the...
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 following sample demonstrates the use of the pop...
prepend($value, $key = null) The prepend method will add an a given $value to the beginning of the collection. You can also supply an optional $key that will be used as the key for the new $value when adding an item to the beginning of an...
pull($key, $default = null) The pull method will remove an item from the collection while 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....
push($value) The push method is the logical opposite of the prepend method and will push an item onto the end of the collection. The push method returns a reference to the original collection instance. The following code example shows how to use...