JeffreyWay / Laravel-Test-Helpers

Easier testing in Laravel.
https://packagist.org/packages/way/laravel-test-helpers
217 stars 40 forks source link

Use Eloquent method to fetch table name #57

Closed dwightwatson closed 8 years ago

dwightwatson commented 10 years ago

The current method of inferring the table name from the class name works using the same code as Eloquent does, but it doesn't support the ability to override the table name. By setting protected $table on a model you are able to set a custom table.

This fix makes use of the getTable() method on the Eloquent model which will first check to see if the table name has been manually set and then, if necessary, infer the table name from the class name. This patch also removes two protected functions which are no longer used.