Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added option for changing the translation table suffix in configurati…

…on. #29
  • Loading branch information...
dimsav committed Aug 20, 2014
1 parent 5388d87 commit 7ecc0a75dfcec58ebf694e0a7feb686294b49847
Showing with 18 additions and 1 deletion.
  1. +2 −1 Translatable/Translatable.php
  2. +4 −0 readme.md
  3. +12 −0 tests/TranslatableTest.php
@@ -65,7 +65,8 @@ public function getTranslationModelName()
public function getTranslationModelNameDefault()
{
return get_class($this) . 'Translation';
$config = App::make('config');
return get_class($this) . $config->get('app.translatable_suffix', 'Translation');
}
public function getRelationKey()
@@ -146,6 +146,10 @@ return array(
// The default locale
'locale' => 'en',
// Override the default 'Translation' class suffix
// to use CountryTrans instead of CountryTranslation
'translatable_suffix' => 'Trans'
);
```

@@ -16,6 +16,18 @@ public function it_finds_the_default_translation_class()
$country->getTranslationModelNameDefault());
}
/**
* @test
*/
public function it_finds_the_translation_class_with_suffix_set()
{
App::make('config')->set('app.translatable_suffix', 'Trans');
$country = new Country;
$this->assertEquals(
'Dimsav\Translatable\Test\Model\CountryTrans',
$country->getTranslationModelName());
}
/**
* @test
*/

0 comments on commit 7ecc0a7

Please sign in to comment.
You can’t perform that action at this time.