Search

In Laravel

Implementing a Custom Laravel Blade Precompiler for Volt and Livewire

Sep 4, 2023

Learn how to implement a custom component compiler for Laravel's Blade templating language in this post. We will build a custom compiler that transforms custom component syntax into a Livewire component, leveraging new features provided by Volt. Follow along as we set up the Blade precompiler and parse custom Blade component syntax. Get started by grabbing the example code on GitHub, and don't forget to install the necessary dependencies.
Creating a Simple Honeypot Field in Laravel

Apr 11, 2023

Learn how to implement a honeypot form mechanism using Laravel. This security measure helps catch bots and automated scripts by adding an inconspicuous form field that human users should leave empty. You can implement the honeypot in two different ways: by creating a custom middleware class or by adding the logic directly to the form's action. Additionally, you can create a custom Blade directive to simplify adding the hidden field to multiple forms.
Announcement: All Of the Laravel Articles Are Free

Jul 22, 2017

Discover the journey behind "Laravel Artisan: An In Depth Coverage of Laravel Features." Find out why the project was eventually converted into free blog posts on the website. Explore the author's other projects and the motivation behind the switch to a new site. Don't miss the free resource, "Laravel Companion: A Guide to Helpers, Collections And More."
Command Interoperability and Laravel Artisan Applications

Dec 7, 2016

Learn how to execute Artisan commands from within other Artisan commands in Laravel. Use the call and callSilent methods to call other commands and return the exit code. Pass arguments and options to the called commands using arrays. Output from called commands can be hidden by using the callSilent method. Commands can also be called from other locations within the application's code base by injecting the console kernel or using the Artisan facade. Operating system calls can be made using Symfony's Process component, which is already available in Laravel. Handle process output by supplying a callback function to the process's run method.
Customizing The Laravel Artisan Application

Dec 7, 2016

Learn how to customize and modify Laravel's Artisan console application to better suit your needs. By extending Symfony's console application, you can make changes to the default command, application name, and version string. Discover where the console application is invoked and brought in, and override the getArtisan method to customize the console application instance. You can change the application name and version number to reflect your own branding. Additionally, you can modify the default command that is executed when no specific command is specified. These modifications are useful for creating a customized experience for your clients and maintaining branding consistency.
Laravel Artisan Cache Command: The cache:clear Command

Dec 7, 2016

Learn how to clear the cache files of your application using the cache:clear command in Laravel. You can optionally specify the cache store to clear using the store parameter. Check out the examples to see how to use the command.
Laravel Artisan Cache Command: The cache:table Command

Dec 7, 2016

Learn how to create a new migration for the cache database table using the cache:table command in Laravel. This table is necessary for the database cache driver. The migration creates a cache table with specific properties. Remember to change the table name in additional migration files to avoid errors when running the migrate command.
Laravel Artisan Closure Based Commands

Dec 7, 2016

Learn about the new shorthand syntax introduced in Laravel 5.3 to simplify writing Artisan commands. The command method in the console kernel allows you to define commands with a signature and a callback function. The signature defines the input requirements, and the callback function has access to the underlying ClosureCommand instance. You can also set a description for the command using the describe method. Additionally, you can register commands using the console.php file in the routes directory.
Laravel Artisan Config Command: The config:clear Command

Dec 7, 2016

The config:clear command is used to delete the configuration cache file created by config:cache. It will remove the bootstrap/cache/config.php file by default. Use the php artisan config:clear command to clear the configuration cache.
Laravel Artisan Custom Styles: Custom Progress Bar Styles

Dec 7, 2016

Learn about how to customize console progress bars in Laravel commands. Progress bars in Laravel commands are instances of the Symfony\Component\Console\Helper\ProgressBar class and inherit styles from Symfony's console styles. The default styles differ based on the operating system. The diagram in the article explains the default Windows and Unix-like system styles and the components of a console progress bar. Progress bar formats use placeholders like current, max, bar, percent, elapsed, remaining, estimated, memory, and message to control appearance. Various examples demonstrate how to set formats and customize components like bar character, empty bar character, progress character, and bar width. Other methods like getBarCharacter, getEmptyBarCharacter, getProgressCharacter, setEmptyBarCharacter, setProgressCharacter, setBarWidth, and setMessage are also explained. This article is a valuable resource for anyone looking to customize console progress bars in Laravel commands.
Laravel Artisan Database Command: The db:seed Command

Dec 7, 2016

The db:seed command is used to automatically add records to a database using a Seeder class. You can specify a specific seeder class, database connection, or force the seed to run in production. Examples of how to use the db:seed command are provided.
Laravel Artisan Event Command: The event:generate Command

Dec 7, 2016

The event:generate command in Laravel allows you to automatically generate missing events and listeners based on your event service provider. It creates the necessary event and listener classes for you, which are stored in specific files. This command does not overwrite any previously generated classes and can be run multiple times. Alternatively, you can manually generate the event and listener classes using the make:event and make:listener commands, providing the event class and its associated listener class respectively.
Laravel Artisan General Command: The clear-compiled Command

Dec 7, 2016

Learn how to use the clear-compiled command to clear the compiled classes and services cache in your Laravel application. The command, when run, deletes the compiled.php and services.php files from the bootstrap/cache/ directory. Execute the command php artisan clear-compiled to remove these files if they exist.
Laravel Artisan General Command: The clear-resets Command

Dec 7, 2016

The auth:clear-resets command in Laravel is used to remove expired password reset tokens from the database. It has an optional name parameter to specify the password broker to clear tokens for. Two examples of using this command are shown. Running auth:clear-resets will delete expired tokens for the default password broker. This command is handy to keep the password_resets table clean.

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.