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.
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 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
- Check the model for the method/scope
- Use
->get()before collection methods composer showto verify the package providing the macro
Detailed fix by platform
Laravel
php artisan tinkerthenPost::first()->getRelations()/method_exists(Post::class, 'scopeActive')
How to diagnose
- Receiver — Builder, Model or Collection?
- Method — Defined?
- 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:
Similar errors
- Attempt to read property "x" on null Laravel/PHP 8: ErrorException: Attempt to read property "name" on null
- Class "App\Models\X" not found Laravel: Error: Class "App\Models\Post" not found
- Command "x" is not defined Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these?
Most viewed in Laravel
- The GET method is not supported for route Laravel: The GET method is not supported for route x. Supported methods: POST (MethodNotAllowedHttpException)
- 403 This action is unauthorized Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized.
- Route [login] not defined Laravel: Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 4 Nov 2026