| 1 | <?php |
||
| 8 | class Person extends Eloquent |
||
| 9 | { |
||
| 10 | protected $table = 'people'; |
||
| 11 | |||
| 12 | use Translatable; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Array with the fields translated in the Translation table. |
||
| 16 | * |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | public $translatedAttributes = ['name']; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Set $translationModel if you want to overwrite the convention |
||
| 23 | * for the name of the translation Model. Use full namespace if applied. |
||
| 24 | * |
||
| 25 | * The convention is to add "Translation" to the name of the class extending Translatable. |
||
| 26 | * Example: Country => CountryTranslation |
||
| 27 | */ |
||
| 28 | public $translationModel; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * This is the foreign key used to define the translation relationship. |
||
| 32 | * Set this if you want to overwrite the laravel default for foreign keys. |
||
| 33 | * |
||
| 34 | * @var |
||
| 35 | */ |
||
| 36 | public $translationForeignKey; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * The database field being used to define the locale parameter in the translation model. |
||
| 40 | * Defaults to 'locale'. |
||
| 41 | * |
||
| 42 | * @var string |
||
| 43 | */ |
||
| 44 | public $localeKey; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Mutate name attribute into upper-case. |
||
| 48 | * |
||
| 49 | * @param $value |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function getNameAttribute($value) |
||
| 57 | } |
||
| 58 |