diff --git a/config/translation-manager.php b/config/translation-manager.php index 8768907a..e77e4ede 100644 --- a/config/translation-manager.php +++ b/config/translation-manager.php @@ -67,8 +67,9 @@ ], /** - * Database connection name to allow for different db connection for the translations table. + * Database table and connection name to allow for different db connection for the translations table. */ + 'db_table' => env('TRANSLATION_MANAGER_DB_TABLE', null), 'db_connection' => env('TRANSLATION_MANAGER_DB_CONNECTION', null), ]; diff --git a/src/Models/Translation.php b/src/Models/Translation.php index 63d915a4..bbc6b6fe 100644 --- a/src/Models/Translation.php +++ b/src/Models/Translation.php @@ -52,6 +52,20 @@ public function scopeSelectDistinctGroup($query) return $query->select(DB::raw($select)); } + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + if ($table = config('translation-manager.db_table')){ + return $table; + } + + return parent::getTable(); + } + /** * Get the current connection name for the model. *