CSRF stands for Cross-Site Request Forgery.
CSRF Protection is a security feature in Laravel (and all modern web frameworks) that helps prevent unauthorized or malicious requests from being made on behalf of an authenticated user.

๐Ÿ”„ Simple Explanation (Hindi + English)

๐Ÿ”ธ English:

CSRF is an attack where a user is tricked into submitting a request they didnโ€™t intend to. Laravel protects you from this by using CSRF tokens in forms. Only if the token matches, the request is accepted.

๐Ÿ”ธ Hindi:

CSRF เคเค• เคเคธเคพ เคนเคฎเคฒเคพ เคนเฅ‹เคคเคพ เคนเฅˆ เคœเคฟเคธเคฎเฅ‡เค‚ user เค•เฅ‹ เคงเฅ‹เค–เฅ‡ เคธเฅ‡ เค•เฅ‹เคˆ เคเคธเคพ request เคญเฅ‡เคœเคจเฅ‡ เค•เฅ‡ เคฒเคฟเค เคฎเคœเคฌเฅ‚เคฐ เค•เคฟเคฏเคพ เคœเคพเคคเคพ เคนเฅˆ เคœเคฟเคธเฅ‡ เคตเคน เค–เฅเคฆ เคจเคนเฅ€เค‚ เค•เคฐเคจเคพ เคšเคพเคนเคคเคพเฅค Laravel เค‡เคธเคธเฅ‡ เคฌเคšเคพเคต เค•เฅ‡ เคฒเคฟเค เคนเคฐ form เคฎเฅ‡เค‚ CSRF token เคฆเฅ‡เคคเคพ เคนเฅˆ, เคœเฅ‹ เคนเคฐ session เค•เฅ‡ เคฒเคฟเค unique เคนเฅ‹เคคเคพ เคนเฅˆเฅค เค…เค—เคฐ เคฏเคน token valid เคจเคนเฅ€เค‚ เคนเฅˆ เคคเฅ‹ Laravel เค‰เคธ request เค•เฅ‹ reject เค•เคฐ เคฆเฅ‡เคคเคพ เคนเฅˆเฅค

โœ… Real-World Example (Hindi + English):

โœ… Imagine:

You’re logged into your bank account. If someone sends you a fake form that transfers money from your account, without CSRF protection, it might actually go through.

But with CSRF protection:

  • Laravel adds a hidden token in every form.
  • When the form is submitted, Laravel checks the token.
  • If it doesnโ€™t match โ†’ request is rejected.

โœ… Syntax in Laravel Blade:

bladeCopyEdit<form method="POST" action="/submit">
    @csrf   <!-- This adds the CSRF token automatically -->
    <input type="text" name="name">
    <button type="submit">Submit</button>
</form>