In Laravel

Laravel String Pluralization

Nov 30, 2016

Learn how to handle pluralization and specific numbers in Laravel's translator. Message tags can be used as comments for different plural translation messages. Laravel allows for handling specific numbers by passing them directly to the translation message. Intervals can also be used in translation messages to match a range of numbers.
Laravel's Bcrypt Hasher

Nov 30, 2016

Learn about the Bcrypt hasher in Laravel, how to set the number of rounds for the hash calculation, and how to generate and check hashes using the make and check methods. See examples of generating hashes and checking their validity. Also, discover how to determine if a hash needs to be rehashed and how to use the Hash facade to access hasher methods.
The Laravel Translator

Nov 30, 2016

The Translator class is responsible for handling interactions between the application and the translation systems. It implements Symfony's TranslatorInterface and provides functions to determine if a translation exists, retrieve translations with replacements, and pluralize translations. The class also allows you to set and get the current locale and fallback locale. You can access the Translator instance from the application container using the translator name.
An Introduction To Laravel Collections

Nov 29, 2016

Learn to use the Illuminate\Support\Collection class in Laravel to manipulate data using familiar array syntax. Access and iterate through the collection using key/value pairs. Retrieve values associated with known keys and work with the underlying array using the toArray method. Be aware that array-specific functions will not work directly on a collection, but can be used on the underlying array. Use methods like get to retrieve data from the collection with the option to return a default value. Create a new collection instance by passing an array of items to the constructor, or by using the make method or the collect helper function.
An Introduction to Laravel Message Bags

Nov 29, 2016

The Illuminate\Support\MessageBag class is a key/value storage system for storing different types of messages and specifying a format for returning them. It implements both the Illuminate\Contracts\Support\MessageProvider and Illuminate\Contracts\Support\MessageBag interfaces. The MessageProvider interface allows other classes to return MessageBag implementations. This article also provides a list of classes that extend, implement, or make use of the MessageProvider interface. Check out the rest of the articles in the series to learn more about the Laravel ErrorMessageBag component.
An Introduction to Laravel View Error Bags

Nov 29, 2016

The Illuminate\Support\ViewErrorBag class is a container for error messages used to communicate with views and responses. When there are errors in the current request, an instance of ViewErrorBag is shared with views. The ViewErrorBag instance can be accessed using the errors name. The class provides several public methods for interacting with the error bags.
An Introduction to Laravel's Collection Public API

Nov 29, 2016

Learn about the public API of the Collection class in this section. With 64 methods, this extensive API allows you to retrieve values, transform arrays, implement pagination, and perform simple aggregates. You'll gain a deep understanding of this powerful class, excluding methods needed for implementing PHP's ArrayAccess and IteratorAggregateinterfaces, as well as the getCachingIterator method.
Laravel Collection Public API: all

Nov 29, 2016

The all method in Laravel allows you to retrieve the underlying array that a collection is using to store its data. This method can be useful when you need to work with the raw array data instead of the collection object. The all method preserves any nested collections within the main collection, making it easy to access and manipulate the entire data structure. If you want to convert nested collections to arrays as well, you can use the toArray method instead.
Laravel Collection Public API: chunk

Nov 29, 2016

The chunk method in Laravel allows you to break a large collection into smaller collections. The method takes two parameters: $size, which determines the size of each new collection, and $preserveKeys, which indicates whether the new collections should retain the original array keys. By default, the newly created collections will not have the original array keys, but you can change this behavior by setting $preserveKeys to true.
Laravel Collection Public API: collapse

Nov 29, 2016

The collapse method is used to combine all the first-level items of a collection into a new, single collection. It does not recursively collapse inner arrays. When called, it returns an instance of the Collection class. The collapse method can be particularly useful when working with nested arrays or collections.
Laravel Collection Public API: contains

Nov 29, 2016

The contains method in Laravel's Collection class is used to check if a specific key or a key/value pair exists within the collection. It can be used with simple values, arrays, or even objects. The method can also take a function as an argument to perform complex truth tests. However, it's important to note that when the second argument is explicitly set to null, the method will always return true, regardless of the existence of the key or key/value pair.
Laravel Collection Public API: count

Nov 29, 2016

The count method in Laravel's Collection class returns the total number of items in the collection. It is a straightforward method that returns an integer. Use the count method to easily determine the size of a collection without the need for a loop.
Laravel Collection Public API: diff

Nov 29, 2016

The diff method is used to find the items in the collection that are not present in another collection. It returns a new Collection instance. You can pass either an array or another Collection instance as the argument. Here are some examples of how to use diff with arrays and Collection instances.
Laravel Collection Public API: diff_keys

Nov 29, 2016

The diffKeys method is used to determine which items in a collection have keys that are not present in the keys of another collection. The method takes an array or another collection as its parameter. In the first example, the $differences variable will only contain the key price since it is the only key in the first collection that is not present in the second collection. In the second example, the $differences variable will only contain the key description since it is the only key in the second collection that is not present in the first collection.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.