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

**Code:** `BadMethodCallException: Call to undefined method` · **Category:** Laravel · **Seen on:** Laravel, PHP

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/laravel/call-to-undefined-method-eloquent)
