---
title: "lint/laravel/no-controller-middleware"
pagination: false
---

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

<RuleId id="lint/laravel/no-controller-middleware" />

Not in any set. Report only. Runs when laravel is installed.

## What it does

This rule warns against applying middlewares in controllers.

## Configuration

```toml title="pun.toml"
[lint.rules]
"laravel/no-controller-middleware" = "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

- [`middleware-in-routes`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#middleware-in-routes) (mago-linter)

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