---
title: "lint/laravel/prefer-pivot-class"
pagination: false
---

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

<RuleId id="lint/laravel/prefer-pivot-class" />

In the [`lint-strict`](/docs/rules/presets/lint-strict) preset. In Rector's [`rector-laravel/laravel-code-quality`](/docs/rules/sets/rector-laravel/laravel-code-quality) set. Needs the [`laravel` extension](/docs/configuration/pun-toml#extensions). Unsafe fix: it can change behavior. **Planned: not in Pun yet.** Enabling it is a config error.

## What it does

Changes the pivot table name of a many to many relation to the pivot model class.

## Replaces

- [`RelationTableStringToPivotClass`](https://getrector.com/rule-detail/relation-table-string-to-pivot-class-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)
