Articles

Laravel 5 Collections: Retrieving Collection Elements At a Specific Interval With nth

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

Laravel 5 Collections: Retrieving Collection Elements Whose Keys Are Not Present in the Provided Keys With diffKeys

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

Laravel 5 Collections: Retrieving Collection Elements With all

Laravel 5 The all method can be used to retrieve the underlying array that the collection is using to hold its data. Signature The signature of the all method is: public function...

Laravel 5 Collections: Retrieving Collection Elements With get

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

Laravel 5 Collections: Retrieving the Collection Element's Keys With keys

Laravel 5 The keys method is used to retrieve the keys of all items in the collection. The keys method returns a new Collection instance. The behavior of the keys method is similar...