In Laravel

Laravel String Helper Functions

Nov 16, 2016

Learn about the string helper functions in Laravel that can simplify common string operations in PHP. These functions, found in the static class Illuminate\Support\Str, include useful methods like checking if a string contains a substring, or if a string starts or ends with another string. Laravel's string helper functions treat string values as immutable, meaning that a new, modified copy of the string will be returned from the function. Find out more about these powerful tools in this informative post.
Laravel Translation Helper Function: trans

Nov 16, 2016

Learn how to use the trans helper function to retrieve translations in Laravel. The function takes a $key parameter corresponding to an array key, and allows for replacements with the $parameters array parameter. Specify the desired locale with the $locale parameter. Explore examples of using the $parameters parameter to replace placeholders in translations. Remember that the placeholder name in $parameters should not include the : character.
Laravel Translation Helper: trans_choice

Nov 16, 2016

Learn how to use the trans_choice helper function in Laravel to pluralize and translate a given string based on a specific locale. This function accepts the $id of the string to be translated and the $number of objects in the collection, as well as optional replacements. Pluralized strings can contain multiple messages separated by the | character, allowing for different messages to be displayed for different numbers. To retrieve the correct message, provide the appropriate $number and any necessary replacements in the function call. Apply this helper function in your Laravel projects to handle pluralization and translation with ease.
Special Cases for Laravel's Pluralization Features

Nov 16, 2016

This table lists words and word endings that are not affected by the plural method. Some words already exist in their plural form, while others do not have an inflection available. Additionally, there are some special cases where the method handles the inflection differently for words like "atlas" and "child."
Special Cases for Laravel's Singular Pluralization Feature

Nov 16, 2016

This table lists word endings that will not be affected by the singular method. It includes various word endings like -*ese*, -*ese*, -*ese*, and -*nese*. Additionally, there are special cases where certain words do not have a clear method of handling inflection, such as *brothers*, *children*, *genus*, and *people*.
Calculating Averages Using Collections in Laravel

Mar 23, 2016

Learn how to use the avg method in Laravel collections to calculate the average value of items. You can use the optional $key parameter to specify which property of the collection to average. If no key is provided, the method assumes the collection contains numeric values and averages all items. The avg method also works on collections of objects using the same syntax. Additionally, you can use "dot" notation to average nested properties in arrays or objects.
Semantic UI Paginator for Laravel 4

Dec 13, 2014

Learn how to create a custom paginator for Semantic UI in Laravel 4 with this step-by-step tutorial. The tutorial provides the necessary HTML markup and code snippets, along with explanations, to guide you through the process. By the end, you'll have a Paginator that generates Semantic UI compatible markup.
Laravel and Kint Debugging

Sep 20, 2014

Learn how to enhance your Laravel development workflow by integrating Kint, a powerful debugging tool. Follow the steps provided in this tutorial to require Kint in your project and modify one of its functions to work seamlessly with Laravel. Discover how to use the new lk() function as a replacement for Laravel's dd() function to display detailed Kint table breakdowns. Improve your debugging experience with this simple yet effective solution.
Laravel Paginator Pretty URLs

Jul 28, 2014

Learn how to create pretty pagination URLs with Laravel's paginator in this step-by-step tutorial. By extending the Paginator class and overriding the getUrl() method, you can generate URLs like http://localhost:8000/users/page/1 instead of http://localhost:8000/users?page=1. The tutorial includes code examples and explains how to create a custom PrettyPaginator class and use it in your application. Keep in mind that there might be a package available to accomplish this task, so proceed with caution.
Part Two: Creating a Custom Pagination View in Laravel

Jul 28, 2014

Learn how to create a custom pagination view in Laravel that includes hidden form input elements to pass search terms and page numbers. Using a view composer, you can generate hidden form inputs based on user input and append them to the pagination view, allowing users to navigate through search results while maintaining their search criteria. Additionally, you can use the appends() method to include input and URL parameters when generating pagination links, ensuring that search data is preserved when users click on the links.
Part One: Creating a Custom Pagination View in Laravel

Jul 21, 2014

Learn how to create a custom paginator view in Laravel 4 that allows users to enter a specific page number in a text box and jump to that page. The tutorial walks you through implementing the view step-by-step, including adding clickable links and the text box. The end result is a simple pagination view with a text box that lets users easily navigate through large data sets without an infinite-scroll-like solution. Note that the tutorial mentions the use of inline styles, which ideally should be separated into their own stylesheet, and also hints at a part 2 that covers handling filtered data sets.
Getting Kint to Work With Laravel 4.1

May 14, 2014

Kint is a PHP tool designed to make debugging PHP easier and more organized. It takes output from PHP's var_dump() and debug_backtrace() functions and formats it nicely. While not part of Laravel itself, Kint can be used in conjunction with Laravel's dd function for a powerful debugging combination. Some users have had issues getting Kint to work with Laravel, but one solution is to modify the order of dependencies in the composer.json file. Alternatively, you can manually adjust the autoload_files.php file to ensure that Kint is loaded before Laravel.
Laravel 4: Be Careful With Your After Filters

Apr 4, 2014

Learn how to use the after filter in Laravel 4 to perform tasks after your routes and controllers have run. This filter can be used for various purposes, such as logging or checking specific conditions. By using the after filter, you can manipulate the response content before it is sent to the client. However, if you are working with views and want to avoid potential issues with nested queries being executed twice, it is recommended to use the getContent() function instead of casting the view object to a string.
Laravel 4: Working With Checkboxes and Input

Apr 1, 2014

Learn how to create a checkbox in a Blade view using the Form class in Laravel. You can check if a checkbox is checked in a controller by using an if statement. Ensure the checked state of the checkbox is set by passing a boolean value as the third argument in the checkbox function. You can also use Input::old() to set the checked state based on the previous input.

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.