Bird
0
0

Which of the following is the correct way to include CSRF protection in a Laravel Blade form?

easy📝 Syntax Q12 of 15
Laravel - Request and Response
Which of the following is the correct way to include CSRF protection in a Laravel Blade form?
A<code><form> @csrf </form></code>
B<code><form> <csrf> </form></code>
C<code><form> <input type='csrf'> </form></code>
D<code><form> <token> @csrf </form></code>
Step-by-Step Solution
Solution:
  1. Step 1: Recall Laravel's CSRF directive

    Laravel uses the Blade directive @csrf inside forms to add a hidden CSRF token input automatically.
  2. Step 2: Check syntax correctness

    Only @csrf is valid; other tags like <csrf> or <token> are invalid HTML or Blade syntax.
  3. Final Answer:

    <form> @csrf </form> -> Option A
  4. Quick Check:

    Use @csrf in Blade forms [OK]
Quick Trick: Use @csrf inside Blade forms for security [OK]
Common Mistakes:
  • Writing invalid HTML tags like
  • Forgetting to add CSRF token causes errors
  • Using input type='csrf' which is not valid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes