
Set up a new Laravel project named collections, generate a collection controller with an index method, define a route for get /collections to the controller, and run the local server.
Learn what a Laravel collection is, how to create one with collect, and how its max method quickly returns the maximum value from data arrays.
Explore how to use Laravel collections' average and contains to compute averages from numeric values, handle keyed data, check for key–value presence, and optionally use a callback for evaluation.
Explore the sum and count methods in Laravel collections, including sums of numeric values, counting by conditions, and extracting unique items, with examples like ages, exam results, and product colors.
Learn to use Laravel collections filter and reject with callbacks to select values by conditions such as greater than three or greater than or equal to 12, including multidimensional arrays.
Explore Laravel collections by using skip, skip until, and skip while to omit initial elements based on indexes or conditions, with practical examples showing expected results.
Learn how to retrieve the first and last elements from a Laravel collection using first and last methods, including callbacks, default values, and handling nonzero indices.
Sort a Laravel collection by score or name using the sort by method, reset indexes with values, and use a callback to sort by name length or reverse.
Explore using max and min to retrieve maximum and minimum values from Laravel collections, with optional keys for nested data and applicability to flat and empty collections.
Learn to insert new values into a Laravel collection using put and push methods, including key-value entries and arrays.
Master Laravel collections by grouping items by status and using key by to assign custom keys, enabling quick access to online and offline users and handling duplicates.
Learn how to remove duplicates from a Laravel collection using the unique method, selecting a name key and resetting indices with values.
Learn to filter a Laravel collection using the where method, extracting names equal to Ahmed and scores greater than five.
Learn to filter a Laravel collection using whereIn and whereNotIn to include or exclude multiple scores, then reset indices with values() for clean results.
Learn to filter a collection by score with where between, specify the min and max range, and manage results using first and values methods, including not between for out-of-range values.
Learn how to filter a Laravel collection by null and non-null values using whereNull and whereNotNull, returning names based on a key in a sample collection.
Learn how to filter a Laravel collection to get the first result using firstWhere or first, when filtering for a score greater than five.
Use the map method to create a new collection by applying a callback to each value, optionally using the index, to multiply values by three or capitalize with ucfirst.
Learn the transform method in Laravel collections to modify in place, such as capitalizing names by value, compare it with map, and see when updates occur versus creating new collections.
Master Laravel collections by learning how to check if a collection is empty or not using the empty function, with examples using arrays, keys, and refreshing results.
Use the flatten method to convert multi-dimensional Laravel collections into a single-dimensional set of values, removing nested keys. Limit depths to return only direct values.
Learn to create a custom Laravel collection macro, register it via the app service provider, and filter values (even numbers) using a divide-by-n function with filter or reject.
Discover a real world example of extending Laravel collections with macros. Build a custom even method, reusable filters, and integrate them via a service provider.
If you want to work with arrays and objects quickly and efficiently in you Laravel projects , and save time playing around loops, here is the right place .
In this course we will learn together one of the most powerful Laravel features is collection .
Collection is a class that enables us to working with arrays and objects in professional and speed way so it saves our time by avoiding using for loops .
What does exactly this course include ?
using Laravel collection in efficient ways .
completely migration from loops to collection .
mapping collection .
Modifying collection .
applying collection functions with real world examples .
calculating average for any array with any depth .
Filtering collections with complex cases and according to different logics .
Sorting collections in professional way.
Grouping collections .
Making collections unique .
using where clauses to filter collections .
reseting indexes in easy way .
when and where to use collection in your project
and more ...
Which Laravel version we will use in this course ?
In this course I use latest Laravel version (now it's 9 in version ) but the content is valid for these versions 6.x and above .
Note : After following and watching the course I think you will completely abandon php native array and objective methods and will move to Laravel collection .