Bird
0
0

You want to quickly generate a model with a migration and a factory using Artisan. Which command is correct?

hard📝 Application Q9 of 15
Laravel - Basics and Architecture
You want to quickly generate a model with a migration and a factory using Artisan. Which command is correct?
Aphp artisan make:model Product --migration --controller
Bphp artisan make:model Product --migrate --factory
Cphp artisan create:model Product -m -f
Dphp artisan make:model Product -m -f
Step-by-Step Solution
Solution:
  1. Step 1: Understand Artisan flags for model generation

    The '-m' flag creates a migration, '-f' creates a factory along with the model.
  2. Step 2: Identify the correct command syntax

    php artisan make:model Product -m -f correctly uses short flags '-m' and '-f' with 'make:model'.
  3. Final Answer:

    php artisan make:model Product -m -f -> Option D
  4. Quick Check:

    Use -m and -f flags to add migration and factory [OK]
Quick Trick: Add -m and -f flags to make:model for migration and factory [OK]
Common Mistakes:
  • Using wrong flag names
  • Using create:model instead of make:model
  • Mixing long and short flags incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes