---
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 [`code-quality`](/docs/rules/sets/code-quality) set. Unsafe fix: it can change behaviour. Runs when laravel is installed. **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)
