Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

lint/laravel/no-implicit-model-query

In the lint-strict preset. In Rector’s rector-laravel/laravel-eloquent-magic-method-to-query-builder set. Needs the laravel extension. Unsafe fix: it can change behavior.

What it does

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

Configuration

[lint.rules]
"laravel/no-implicit-model-query" = "error"

To skip it in some files or lines, add an override or an ignore comment.

Replaces

Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See 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 · Edit this page

Last updated on

Was this page helpful?