Artisan is a command-line interface provided by Laravel. Artisan offers many useful commands for application development.
# View a list of all Artisan commands
php artisan list
# View help for a specific command
php artisan help migrate
# Running the development server
php artisan serve
php artisan serve --host=0.0.0.0 --port=8080
# View app informations
php artisan about
php artisan env
# Performing the migration
php artisan migrate
php artisan migrate --force
# Rollback migration
php artisan migrate:rollback
php artisan migrate:rollback --step=3
# Reset all migrations
php artisan migrate:reset
# Refresh migration (reset + migrate)
php artisan migrate:refresh
php artisan migrate:refresh --seed
# View migration status
php artisan migrate:status
# Running the seeder
php artisan db:seed
php artisan db:seed --class=UserSeeder
# Creating a controller
php artisan make:controller UserController
php artisan make:controller UserController --resource
php artisan make:controller API/UserController --api
# Creating a model
php artisan make:model User
php artisan make:model User --migration
php artisan make:model User -m -c -r # dengan migration, controller, resource
# Creating a migration
php artisan make:migration create_users_table
php artisan make:migration add_email_to_users_table --table=users
# Createing a seeder
php artisan make:seeder UserSeeder
# Creating a factory
php artisan make:factory UserFactory
# Creating a middleware
php artisan make:middleware CheckAge
# Creating a request
php artisan make:request StoreUserRequest
# Creating a resource
php artisan make:resource UserResource
php artisan make:resource UserCollection
# Creating a job
php artisan make:job ProcessPayment
# Creating a event
php artisan make:event UserRegistered
# Creating a listener
php artisan make:listener SendWelcomeEmail
# Creating a mail
php artisan make:mail WelcomeEmail
# Creating at notification
php artisan make:notification InvoicePaid
# Clear cache
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
# Cache optimization
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Optimize for production
php artisan optimize
php artisan optimize:clear