Laravel : Laravel’s important commands

Laravel is a popular PHP framework used for developing web application. Laravel provides a many commands to help you with various development tasks. Here are some of the generic commonly used Laravel commands:

1. General Commands

2. Migration Commands

3. Controller and Resource Commands

4. Route and View Commands

5. Database and Seeder Commands

6. Cache and Optimization Commands

1. General Commands

php artisan list

It will lists all available laravel artisan commands.

php artisan help [command]

It will diisplays help for a specific command.

php artisan --version

It will shows the version of Laravel that you are using.

2. Migration Commands

php artisan migrate

It will runs all pending database migrations. if its available to migrate.

php artisan migrate:status

It will shows the status of each migration.

php artisan migrate:rollback

It will roll back the last batch of migrations.

php artisan migrate:reset

It will rolls back all database migrations. It will drops all the tables that you have created in your database.

php artisan migrate:fresh

 It will rollback all the migrations and then re-run the migrations. it is using for re-create the entire database.

3. Controller and Resource Commands

php artisan make:controller [ControllerName]

It will creates a new controller file/class.

php artisan make:controller [ControllerName] --resource

It will creates a new resource controller with CRUD methods. like index,create,store, edit, update, show and delete.

4. Route and View Commands

php artisan make:route [RouteName]

It will creates a new route file.

php artisan make:view [ViewName]

It will creates a new view file.

5. Database and Seeder Commands

php artisan db:seed

It seeds the database with records.

php artisan make:seeder [SeederName]

It will creates a new seeder class.

6. Cache and Optimization Commands

php artisan cache:clear

It will flushes the application cache.

php artisan optimize

It will optimizes the application for better performance.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 2 =