library translations
Translation trait
bunta/translations
Translation trait
- Friday, August 5, 2016
- by bunta
- Repository
- 0 Watchers
- 0 Stars
- 3 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
translations
instalation
add to "\config\app.php":
'providers' => [
...
Bunta\Translations\TranslationsServiceProvider::class
...
],
add to "\app\SomeModel.php":
...
use \Bunta\Translations\TranslationsTrait;
...
public $translatedAttributes = ['nameVirtualAttributeToTranslate'];
...
run comands
composer du
php artisan optimize
php artisan vendor:publish
php artisan migrate
Usage
Access to right translate
$model->nameVirtualAttributeToTranslate;
Access to all translates
@foreach(Config::get('translations.locales') as $lang)
{!! Form::text("nameVirtualAttributeToTranslate[$lang]",$model->translation('nameVirtualAttributeToTranslate',$lang)) !!}
@endforeach
save translate
Model::create($request->all());