Learn about the fetch helper function in Laravel, which has been deprecated in favor of the pluck helper function. This function allows you to retrieve data from a multi-dimensional array using dot notation. Check out the [An Extended Example of Retrieving Unique Data Using Laravel Helper Functions](/blog/2016/11/18/an-extended-example-of-retrieving-unique-data-using-laravel-helper-functions) article for more insights into Laravel's array helper functions.
Learn how to flatten multi-dimensional arrays with the flatten helper method in PHP. While the dot method preserves keys using dots, the flatten method creates a new array without the original keys. Use array_flatten as a shortcut to Arr::flatten in the global namespace.
Learn how to use the only helper method in Laravel to retrieve specific keys from an array. With the only method, you can easily extract the desired elements from an array by specifying the keys you want. This method is especially useful when working with large arrays and needing to retrieve only certain values. Check out this article to get a detailed explanation and example of the only helper method in action.
Learn about Laravel's array helper functions and how they provide additional functionality on top of PHP's built-in array functions. These functions are located within the Illuminate\Support\Arr class and treat arrays as immutable data structures. See an example of how changes made to an array are returned as a copy of the original array, with the original array remaining unchanged. Discover how Laravel's helper functions support "dot" notation when accessing items in an array, similar to JavaScript's dot notation for accessing object properties.
The ascii helper method in Laravel converts a UTF-8 encoded string into its ASCII equivalent. It accepts a single argument, which should be a string or something that can be cast into a string. This function is useful when communicating with other software platforms that require ASCII, or when complying with protocols like HTTP. In Laravel 5, the ascii function uses the stringy library, while previous versions of Laravel used the patchwork/utf8 package.
Studly caps is a formatting style for text that involves capitalizing the first letter of each word while removing certain word separators. Laravel provides a Str::studly method to implement this formatting. Examples include transforming "my words" to "MyWords" and "my-WORDS" to "MyWORDS". Pascal case, which is similar to camel case with the first letter capitalized, can also be achieved with studly. There is also a global function studly_case available as a shortcut to Str::studly.
Learn how to use the e function in PHP to sanitize user input and prevent potential security vulnerabilities. The e function is a convenient wrapper for PHP's htmlentities function and utilizes the UTF-8 character encoding. By using the e function, you can safely display user input in the browser without the risk of executing malicious code. Discover how to implement the e function and ensure that the browser renders user input as intended.
Learn how to use the camel helper function in Laravel's Illuminate\Support\Str class to convert strings to camel case. Discover examples of how to convert various forms of strings to camel case, and understand that the function only affects the casings of the first character. Additionally, find out about the convenient camel_case function, which is a shortcut to calling Str::camel.
Learn how to use the contains helper method in PHP to check if a given value contains any of the specified needles. The contains method returns true if any needles are found in the haystack, otherwise it returns false. Find out how you can easily call this method using the str_contains function, a shortcut to Str::contains.
The endsWith helper method in Laravel is used to check if a string ends with any of the provided characters. It returns true if the string ends with any of the characters and false otherwise. This method can be used in combination with PHP's range function to check if a string ends with any alphabetical character. Additionally, there is a shortcut function ends_with that can be used instead of calling Str::endsWith directly.
The past six months or so have been incredibly busy. What started as a new article series about cust...
Read moreIn this post I talk about how I resolved a mysterious illegal offset type error when viewing collect...
Read moreGenerating a custom Laravel routes file from a Statamic website to redirect to a new domain.
Read moreDisabling file hashes in Vite output can be accomplished by modifying your project's vite.config.js
Read moreLearn how to implement a custom component compiler for Laravel's Blade templating language in this p...
Read morePart 5 of 6 covers implementing a cache namespace and labeling system, which we can use to target mu...
Read more