Skip to content

Commit 14a1567

Browse files
committed
use csrf helper
1 parent 0b6ff03 commit 14a1567

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

csrf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Laravel makes it easy to protect your application from [cross-site request forge
1212

1313
Laravel automatically generates a CSRF "token" for each active user session managed by the application. This token is used to verify that the authenticated user is the one actually making the requests to the application.
1414

15-
Anytime you define a HTML form in your application, you should include a hidden CSRF token field in the form so that the CSRF protection middleware can validate the request. You may use the `csrf_field` helper to generate the token field:
15+
Anytime you define a HTML form in your application, you should include a hidden CSRF token field in the form so that the CSRF protection middleware can validate the request. You may use the `@csrf` Blade directive to generate the token field:
1616

1717
<form method="POST" action="/profile">
18-
{{ csrf_field() }}
18+
@csrf
1919
...
2020
</form>
2121

routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Sometimes you may need to register a route that responds to multiple HTTP verbs.
6565
Any HTML forms pointing to `POST`, `PUT`, or `DELETE` routes that are defined in the `web` routes file should include a CSRF token field. Otherwise, the request will be rejected. You can read more about CSRF protection in the [CSRF documentation](/docs/{{version}}/csrf):
6666

6767
<form method="POST" action="/profile">
68-
{{ csrf_field() }}
68+
@csrf
6969
...
7070
</form>
7171

0 commit comments

Comments
 (0)