# Collections

Entries tagged with "Collections".

Hidden Methods Beginner

The tap() Helper

Call a closure on a value and return the value, not the closure result. Perfect for chaining side-effects without breaking a fluent chain.

Collections Helpers
Hidden Methods Beginner

Arr::undot()

Expand a flat dot-notation array back into a fully nested structure — the inverse of Arr::dot().

Collections Helpers
Hidden Methods Intermediate

Collection::sole()

Get exactly one matching item from a collection — or throw an exception. A stricter alternative to first().

Collections Database
Hidden Methods Intermediate

Collection::sliding()

Create a sliding window of overlapping chunks from a collection — perfect for moving averages, comparisons, and sequential analysis.

Collections
Hidden Methods Beginner

The Arr::map() Helper

Apply a callback to every element in an array (including nested arrays) without converting to a Collection first.

Collections Helpers
Eloquent Secrets Intermediate

Model::toQuery()

Convert an Eloquent Collection back into a query builder scoped to those exact model IDs — bridging collections and queries.

Collections Database
Hidden Methods Intermediate

Collection::pipeInto()

Pass an entire collection into a class constructor — transform collection pipelines into domain objects in a single call.

Collections Helpers