MeshWorld India Logo MeshWorld.
Back to Tags
Topic View

#Collections.

Explore Collections articles, tutorials, guides, and code examples on MeshWorld India. Learn best practices, get practical tips, and level up your Collections skills.

4 posts
Jan 2020 – Feb 2021
Filed under this topic
Create a Laravel Collection from an Array
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 Arr::flatten(): Flatten Nested Arrays
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
Remove Elements from a Laravel Collection
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
Get an Array of IDs from an Eloquent Collection
Laravel 5 min read

Get an Array of IDs from an Eloquent Collection

Extract an array of IDs from a Laravel Eloquent collection using pluck(), modelKeys(), or direct queries. Find the most efficient method for your needs.

Vishnu
Vishnu