Bird
0
0

Identify the error in this controller method:

medium📝 Debug Q6 of 15
Laravel - Controllers
Identify the error in this controller method:
public function store(Request $request) { $data = $request->input; return $data; }
AMethod name 'store' is reserved.
BMissing return type declaration.
CIncorrect property access; should call input() method.
DRequest class is not imported.
Step-by-Step Solution
Solution:
  1. Step 1: Check how to get input from Request

    In Laravel, input data is accessed by calling $request->input() method, not property.
  2. Step 2: Identify the error

    Using $request->input without parentheses causes an error or returns null.
  3. Final Answer:

    Incorrect property access; should call input() method. -> Option C
  4. Quick Check:

    Request input access = Use input() method [OK]
Quick Trick: Use $request->input() method, not property [OK]
Common Mistakes:
  • Accessing input as property
  • Forgetting to import Request class
  • Thinking method names are reserved

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes