Bird
0
0

What will happen if you run php artisan make:controller BlogController --invokable?

medium📝 component behavior Q4 of 15
Laravel - Controllers
What will happen if you run php artisan make:controller BlogController --invokable?
ACreates a controller with a single __invoke method
BCreates a controller with all resource methods
CCreates a controller and a model named Blog
DThrows an error because --invokable is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand the --invokable flag

    The --invokable flag creates a controller with only one method: __invoke.
  2. Step 2: Confirm the controller type created

    This controller is designed to be called as a single-action controller.
  3. Final Answer:

    Creates a controller with a single __invoke method -> Option A
  4. Quick Check:

    Invokable controller creation = C [OK]
Quick Trick: Use --invokable for single-action controllers [OK]
Common Mistakes:
  • Thinking it creates resource methods
  • Assuming it creates models
  • Believing the flag is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes