Bird
0
0

Find the mistake in this route registration:

medium📝 Debug Q7 of 15
Laravel - Controllers
Find the mistake in this route registration:
Route::get('/hello', [HelloController::class]);

Assuming HelloController is a single action controller.
ARoute path is invalid
BCorrect syntax for single action controller
CController class name is incorrect
DArray syntax missing method name causes error
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct route syntax for single action controllers

    It should be Route::get('/hello', HelloController::class); without array.
  2. Step 2: Identify error in array usage

    Using array with only class name causes syntax error because method name is missing.
  3. Final Answer:

    Array syntax missing method name causes error -> Option D
  4. Quick Check:

    Single action route = class name only, no array [OK]
Quick Trick: Use class name alone for single action controller routes [OK]
Common Mistakes:
  • Using array with class only
  • Adding method name unnecessarily
  • Wrong route path

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes