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.
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.
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.
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.
Learn how to improve the performance of your Laravel application by using the config:cache command. This command clears the existing configuration cache and generates a new cache file, resulting in faster loading of configuration values. Find out where the configuration cache file is located and how to run the command.
Learn how to put your Laravel application into maintenance mode using the down command. This command creates a file called down in the designated storage path, signaling maintenance mode. Easily execute this command with php artisan down.
Learn how to use the env command in Laravel to retrieve the name of the current framework environment. The environment name is determined by the value set in the .env file, particularly the APP_ENV entry. Execute php artisan env to see the current environment.
The app:name command in Laravel is used to update the application namespace. By running php artisan app:name, you can change the namespace for your Laravel application. This command accepts one argument, which is the new name of the application namespace. For example, if you run php artisan app:name LaravelArtisan, the namespace in the files such as Controller.php will be updated to LaravelArtisan\Http\Controllers.
Learn how to optimize your Laravel application's performance using the optimize command. This command offers two flags: --force, which writes the compiled class file even in debug mode, and --psr, which skips creating an optimized class map loader for better performance. The compiled files cache is written to bootstrap/cache/compiled.php. Examples of using the optimize command include generating a compiled class file with default options, excluding Composer autoload files, and running it on a development or debug machine. When using the --psr flag, the composer dump-autoload command is executed, while without it, composer dump-autoload -o is called.
Learn how to use the serve command in Laravel to run your application using the PHP development server. This command is particularly useful for development and testing purposes. You can customize the server address and port by using the optional host and port options. Note that when using HHVM, it must be at least version 3.8.0 to use the internal development server. Check out the examples provided to get started quickly.
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