---
title: "lint/laravel/prefer-request-validate"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/laravel/prefer-request-validate" />

Not in any set. Unsafe fix: it can change behaviour. Runs when laravel is installed.

## What it does

Change `Request::validate()` and `request()` to an injected `$request`. Adds a `Request $request` parameter to the method, so update its callers.

## Configuration

```toml title="pun.toml"
[lint.rules]
"laravel/prefer-request-validate" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`RequestStaticValidateToInject`](https://getrector.com/rule-detail/request-static-validate-to-inject-rector) (rector-laravel)

[More lint/laravel rules](/docs/rules/lint/laravel) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
