Bird
0
0

Which artisan command is used to generate a new application key in Laravel and automatically update the .env file?

easy📝 Syntax Q3 of 15
Laravel - Configuration and Environment
Which artisan command is used to generate a new application key in Laravel and automatically update the .env file?
Aphp artisan config:cache
Bphp artisan key:generate
Cphp artisan migrate
Dphp artisan make:key
Step-by-Step Solution
Solution:
  1. Step 1: Identify key generation command

    The command php artisan key:generate generates a new application key and updates the .env file.
  2. Step 2: Exclude other commands

    config:cache caches config, migrate runs migrations, and make:key is not a valid command.
  3. Final Answer:

    php artisan key:generate -> Option B
  4. Quick Check:

    Key generation uses key:generate [OK]
Quick Trick: Use key:generate to create and set app key [OK]
Common Mistakes:
  • Using config:cache instead of key:generate
  • Assuming make:key is a valid command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes