---
title: "lint/laravel-12/prefer-scope-attribute"
pagination: false
---

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

<RuleId id="lint/laravel-12/prefer-scope-attribute" />

Not in any preset. In Rector's [`rector-laravel/laravel-120`](/docs/rules/sets/rector-laravel/laravel-120), [`rector-laravel/up-to-laravel-120`](/docs/rules/sets/rector-laravel/up-to-laravel-120), [`rector-laravel/up-to-laravel-130`](/docs/rules/sets/rector-laravel/up-to-laravel-130), [`rector-laravel/up-to-laravel-130-without-attributes`](/docs/rules/sets/rector-laravel/up-to-laravel-130-without-attributes) sets. Needs the [`laravel` extension](/docs/configuration/pun-toml#extensions). Unsafe fix: it can change behavior.

## What it does

Changes model scope methods to use the scope attribute

## Configuration

```toml title="pun.toml"
[lint.rules]
"laravel-12/prefer-scope-attribute" = "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

- [`ScopeNamedClassMethodToScopeAttributedClassMethod`](https://getrector.com/rule-detail/scope-named-class-method-to-scope-attributed-class-method-rector) (rector-laravel)

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