Showing 7 of 1,216 result(s)
The following example highlights the use of the sort method without supplying a user-defined comparison function (by providing an argument for $callback ): After the above code has executed, the $sorted variable will be an instance of Collection...
The $callback parameter can be utilized to provide a custom sorting comparison function. The $callback should define two parameters, which are typically $a and $b . The $callback must return an integer that is less than, equal to or greater than...
The following examples will demonstrate the various ways to invoke the every method: After the above code has executed, the $allAlphabetic variable would contain the value false . In the following example, we will check to see if all users in the...
The every method can also be used with higher order messaging, which allows us to invoke collection methods and access properties on objects using PHP's property accessors syntax. In the following example, we will create a color class with a...
The following code example will transform the case of each string in the collection and return a new collection instance: The $newCollection variable will be an instance of the Collection class and contain a value similar to following output: The...
In this post, I thought it'd be fun to look at implementing a custom component compiler for Laravel's Blade templating language. Grab the example code on GitHub The work in this post was inspired by the following Twitter post: Just imagine…...
Replacing the core Laravel Blade compiler entirely is not recommended, mainly due to the high likelihood of undesirable/unpredictable behavior when interacting with third-party libraries and Laravel itself. The main issues likely to arise are...
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.