---
title: "lint/laravel/no-implicit-model-query"
pagination: false
---

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

<RuleId id="lint/laravel/no-implicit-model-query" />

In the [`lint-strict`](/docs/rules/presets/lint-strict) preset. In Rector's [`rector-laravel/laravel-eloquent-magic-method-to-query-builder`](/docs/rules/sets/rector-laravel/laravel-eloquent-magic-method-to-query-builder) set. Needs the [`laravel` extension](/docs/configuration/pun-toml#extensions). Unsafe fix: it can change behavior.

## What it does

Start Eloquent queries with Model::query() instead of static magic calls.

## Configuration

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

- [`EloquentMagicMethodToQueryBuilder`](https://getrector.com/rule-detail/eloquent-magic-method-to-query-builder-rector) (rector-laravel)
- [`no-implicit-model-query`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-implicit-model-query) (mago-linter)

## Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See [merged rules](/docs/migrate/merged-rules).

- `lint/laravel/prefer-query-builder-call`

As rector-laravel checks, the class must be an Eloquent model that does not declare the method itself; a class that is no model, or that Pun cannot find, is left alone. As Mago does, only query builder methods such as `where()`, `orderBy()` and `latest()` count, on a class written by name.

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