BadMethodCallException: Call to undefined method Laravel Origin: Application & API OSI layer 7 · Application Last updated 4 Nov 2026

Laravel: BadMethodCallException: Call to undefined method App\Models\Post::whereTitle() / Illuminate\Database\Eloquent\Builder::foo()

You called a method the model, builder or collection doesn't have.

Exact message you may see BadMethodCallException: Call to undefined method App\Models\Post::foo()Call to undefined method Illuminate\Database\Eloquent\Builder::foo()Method Illuminate\Support\Collection::foo does not existCall to undefined method Illuminate\Database\Query\Builder::BadMethodCallException Call to undefined method
Seen on: Laravel PHP

Meaning

Typical causes: typo, a scope or relationship not defined, calling collection methods on a query builder (or the other way around), or a facade method that doesn't exist. Remember ->get() returns a Collection while Post::where() returns a Builder.

Common causes

  • Typo in method name
  • Local scope (scopeActive) not defined
  • Relationship method missing on the model
  • Mixing Builder and Collection methods
  • Calling a method added by a package not installed

⚡ Quick fix

  1. Check the model for the method/scope
  2. Use ->get() before collection methods
  3. composer show to verify the package providing the macro

Detailed fix by platform

Laravel

  1. php artisan tinker then Post::first()->getRelations() / method_exists(Post::class, 'scopeActive')

How to diagnose

  1. Receiver — Builder, Model or Collection?
  2. Method — Defined?
  3. Package — Installed?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

Attempt to read property "x" on null — Laravel/PHP 8: ErrorException: Attempt to read property "name" on null (Laravel)Attempt to read prope…Class "App\Models\X" not found — Laravel: Error: Class "App\Models\Post" not found (Laravel)Class "App\Models\X" …Command "x" is not defined — Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? (Laravel)Command "x" is not de…Laravel: Allowed memory size exhausted (request) — Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework (Laravel)Laravel: Allowed memo…MassAssignmentException — Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment (Laravel)MassAssignmentExcepti…ModelNotFoundException in queued job — Laravel Queue: Illuminate\Queue\SerializesModels: No query results for model [App\Models\Order] 42 (job failed) (Laravel)ModelNotFoundExceptio…No query results for model — Laravel: Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Post] 5 (Laravel)No query results for …Property [x] does not exist on this collection instance — Laravel: Exception: Property [name] does not exist on this collection instance. (Laravel)Property [x] does not…BadMethod…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.