I am caught up working on a ERP application for the Romanian furniture manufacturing industry so I named my tables in my native language. The problem with that were the suffixes that Laravel is adding (user -> users) and I ended up having a romanian name for the table ending in “s”. 

To change that, you can use Schema::rename in a new migration. So your up() function will look like this:

  public function up()
  {
      Schema::rename('old_table_name', 'new_table_name');
  }

Once you run the migration the table names will be changed BUT you may encounter some errors saying that the “old_table_name” could not be found. That’s because Laravel is trying to guess the table name and if this happens you should explicitly specify the table name in your Eloquent model like this:

    class NameOfTheClass extends Model
    {
        public $table = 'new_table_name';
    }
Spread the word!

Leave a Reply

Your email address will not be published. Required fields are marked *