M
MeshWorld.
Back to Tags
Topic View

#Collections.

4 posts filed under this topic.

Laravel 5 min read

Create a Laravel Collection from an Array

Learn how to wrap a plain PHP array in a Laravel Collection using collect() or new Collection(). Covers filter, map, sum, and groupBy with real examples.

Vishnu
Vishnu
Laravel 5 min read

Laravel Arr::flatten(): Flatten Nested Arrays

How to flatten multi-dimensional PHP arrays with Laravel's Arr::flatten(). Covers the depth parameter, key discard behavior, and comparison with plain PHP.

Vishnu
Vishnu
Laravel 5 min read

Remove Elements from a Laravel Collection

How to remove items from a Laravel Collection using reject(), filter(), and forget(). Covers closures, key-based removal, and Eloquent collection examples.

Vishnu
Vishnu
Laravel 5 min read

Get an Array of IDs from an Eloquent Collection

Three ways to extract an array of IDs from a Laravel Eloquent collection: pluck(), modelKeys(), and querying direct. Covers when to use each and performance considerations.

Vishnu
Vishnu