Q:

Laravel 4 - is there a way to have a prefix for some tables, but not others? 

Most of my database tables use a prefix set in the database config file, but I have several tables that are static that I use for lookups like States, Countries, etc.  Is there a way to tell Laravel in the models or elesewhere that these tables do NOT use the prefix Right now my seeders and other features don't work because they assume the prefix. 
I have the table names set in the models like this:
protected $table = 'states';

Of course I could either just make them use the prefix like all the other tables or create a separate database connection, but I'm wondering if there's another solution. 
Thanks! 

A:

I was thinking about doing this for a project as well and I came upon this thread:
http://laravel.io/forum/03-20-2014-override-table-prefix-for-one-model
The last comment (as of right now at least) suggests setting up another db connection that uses an alternate (or no) prefix, then tell the specific models you want to use that connection. 
eg
in the model:
protected $connection = 'db_no_prefix';    
protected $table = 'this_table';   

in db config
'connections' = > [
    ...
    'db_no_prefix' => [
        ....
        'prefix' => '', 
    ],
],

A:

There's no way Laravel (or any software in existence) would magically know which of your tables have prefixes and which ones don't if you don't define it somewhere.  The place to define it is exactly where you said, in the model:
// State model
protected $table = 'states';

// Some other model
protected $table = 'pre_mytable';

If your models all clearly have their tables defined, your seeds should work perfectly. 
Now, obviously if some piece of software had a list of database tables defined somewhere, it could iterate through them and determine which ones were prefixed.  But this ultimately defeats the purpose since the original intention was for your software to figure out which ones were prefixed so it could know the table name to access. 
Anyways, its a good practice to explicitly define your table names in the models.  Someday down the road when you or someone else looks at your code, you might wonder what table a model is referring to, but if it's clearly defined then there is no way to be confused.  Never try to rely on too much magic on an app if you want to understand things a year later.