Search

Showing 7 of 1,216 result(s)

/blog/2018/04/22/laravel-5-collections-checking-if-a-collection-contains-items-with-isempty

The isEmpty can be used to determine if the collection has items or not. If the collection has no items, true will be returned, otherwise false will be returned.public function isEmpty();The following example demonstrates the basic usage of the...

/blog/2018/04/22/laravel-5-collections-checking-if-a-collection-contains-items-with-isnotempty

The isNotEmpty method is the logical opposite of the isEmpty method; and it will return a boolean indicating whether or not the collection is not empty.public function isNotEmpty();The following example demonstrates the basic usage of the...

/blog/2018/04/22/laravel-5-collections-combining-collection-elements-into-a-string-with-implode

The implode method will combine the items of the collection together. The Collection 's implode method behaves differently than PHP's implode function in that it can operate on arrays of primitive data types as well as arrays of objects and...

/blog/2018/04/22/laravel-5-collections-combining-the-keys-of-a-collection-with-the-values-of-another-collection-with-combine

The combine method is used to combine the keys of the collection the method was called on with the values of another collection or array (supplied as an argument for $values ). This method also returns a new Collection instance and does not modify...

/blog/2018/04/22/laravel-5-collections-combining-the-values-of-multiple-traversable-sources-with-concat

The concat method will create a new collection by combining the values of the collection instance is called on with the provided $source . It is important to note that the source must implement the Traversable interface. The concat method does not...

/blog/2018/04/22/laravel-5-collections-conditionally-executing-a-callback-on-a-collections-elements-with-unless

The unless method is the logical opposite of the when method. The unless method will execute the provided $callback on the collection; if the provided $value evaluates to false . A $default callback may also be supplied if the provided $value...

/blog/2018/04/22/laravel-5-collections-conditionally-executing-a-callback-on-a-collections-elements-with-when

The when method will execute the provided $callback on the collection if the provided boolean $value evaluates to true . A $default callback may also be supplied if the provided $value evaluates to false . Both of the provided callbacks will...