Showing 7 of 1,216 result(s)
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 $key parameter indicates...
The nth method returns a new collection containing the elements of the original collection that appear at the $step interval (for example, give me every third element within the collection). An $offset may also be specified to indicate which index...
The diffKeys method is similar to the diff method. It is used to determine which items whose keys in the collection are not present in the supplied $items collection's keys. $items can be either an array, or another instead of Collection .The...
The all method can be used to retrieve the underlying array that the collection is using to hold its data.The signature of the all method is: public function all();The following code demonstrates the usage of the all method: After the above code...
The get method can be used to retrieve an item from the collection based of its $key . An optional $default argument can be passed that will be returned if the supplied $key does not exists in the collection. The $default argument can be a simple...
The values method can be used to retrieve a new Collection instance containing only the values of the original collection instance. The keys of the new collection will be reset to consecutive numerical keys, starting at zero. The behavior of the...
The random method will retrieve a random $amount of items from the collection. By default, the random method will return only one item, however a different $number argument can be supplied to change the number of items returned. If the number of...