laravel/laravel — pull request #1074 by JoostK (2012-08-07 10:10:03+00:00)
Title: Calling Eloquent::table() statically gives unexpected results

PHP has a quirk (at least the versions I tested with, 5.3.10 and 5.3.13) that when an instance method is called statically, it will not be routed through `__callStatic` first. Vice versa is also true, but not a problem in this case.

Thus, calling `EloquentModel::table()` calls the instance method normally, which results in static calls and class determination being made to the class which called the method statically.

This is (hopefully) a bug in PHP, but converting `table()` to be a static method fixes the problem.

Note that the change in `__call` is likely to make not any difference, as PHP does never actually get there. This may be different on other versions of PHP.

---

PHP test script:

```php
static_method();

echo PHP_EOL;

Model::instance_method();

echo PHP_EOL, PHP_EOL;
}
}

Context::call();

$context = new Context();
$context->call();
```

outputs:

```
Model
static_method

Model
instance_method

Model
static_method

Context
instance_method
```

As you can see, calling the instance method from an instance yields the wrong results.