Essential Laravel Commands

Here is a list of essential Laravel commands that you will frequently use while developing Laravel applications:

Description: Displays a list of all available Artisan commands.

php artisan list

Description: Displays help information for a specific command.

php artisan help [command]

Description: Creates a new Eloquent model class.

php artisan make:model ModelName

Description: Creates a new controller class.

php artisan make:controller ControllerName

Description: Creates a new database migration file.

php artisan make:migration create_table_name

Description: Runs the database migrations.

php artisan migrate

Description: Runs a specific migration.

php artisan migrate --path=/database/migrations/filename.php

Description: Runs all migrations fresh, dropping all tables and re-running migrations.

php artisan migrate:fresh

Description: Runs a specific migration fresh, dropping only the relevant tables and re-running the specified migration.

php artisan migrate:fresh --path=/database/migrations/filename.php

Description: Adds new columns to an existing migration file.

php artisan make:migration add_columns_to_table_name --table=table_name

Description: Generates a new middleware class.

php artisan make:middleware MiddlewareName

Description: Seeds the database with records.

php artisan db:seed

Description: Lists all registered routes in the application.

php artisan route:list

Description: Clears the application cache.

php artisan cache:clear

Description: Creates a cache file for faster configuration loading.

php artisan config:cache

Description: Starts processing jobs on the queue.

php artisan queue:work

Description: Generates a new event class.

php artisan make:event EventName