anekdotes / polyglot
Abstract model that eases the localization of Illuminate model.
1.1.1
2016-10-14 13:19 UTC
Requires
- php: >=5.6.0
- anekdotes/support: <2.0.0
Requires (Dev)
- phpunit/phpunit: ~5.4
This package is auto-updated.
Last update: 2024-11-13 03:53:54 UTC
README
Abstract model that eases the localization of Illuminate model.
Installation
Install via composer into your project:
composer require anekdotes/polyglot
Usage
Extends the model you wish to translate with the class
class Test extends TranslatedModel
Add the desired translated columns to the polyglot array (locale has to be there)
protected $polyglot = ['locale', 'title', 'description', 'slug'];
Don't forget to also add the translated columns to the fillable array
protected $fillable = ['rank', 'locale', 'title', 'description', 'slug'];
Make a new file preferably Lang.php and extends Illuminate Model
class TestLang extends Model
Add the translated columns to the fillable array and set timestamps to false
protected $fillable = ['locale', 'title', 'description', 'slug']; public $timestamps = false;