So I have a simple, empty Eloquent class: class Worker extends Eloquent {}
.
Then in the controller I write: Worker::find(1);
and I get an exception, saying that the SQL is incorrect:
select * where `id` = ?
Obviously, the from SQL clause is missing.
Oh, I downloaded the Laravel 4 for this app today.
In Laravel 4 you have to set a table property
protected $table = 'foo';
As already mentioned, you have to specifically set a
$table
property on the model. Taylor has mentioned here that the old way of doing things (a default table name as the plural of the model's name) may be returning. There just isn't a good composer package for pluralising, so the L3 code may be ported.