Skip to content

Commit

Permalink
Correct beforeAction() argument type
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustMiller authored Feb 2, 2024
1 parent cb87f63 commit b2caa66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/4.x/extend/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ Perform request validation in your controller’s `beforeAction()` method to enf
Craft requires a valid [CSRF token](../dev/controller-actions.md#csrf) for any <badge vertical="baseline" type="verb">POST</badge> requests. This can be disabled for an entire controller by overriding its `$enableCsrfValidation` property, or just for a specific action:

```php
public function beforeAction($actionId): bool
public function beforeAction($action): bool
{
// Don’t require a CSRF token for incoming webhooks:
if ($actionId === 'receive-webhook') {
if ($action->id === 'receive-webhook') {
$this->enableCsrfValidation = false;
}

return parent::beforeAction($actionId);
return parent::beforeAction($action);
}
```

Expand Down

0 comments on commit b2caa66

Please sign in to comment.