bunta/translations

Translation trait

Maintainers

Package info

github.com/aanyszek/translations

Homepage

pkg:composer/bunta/translations

Statistics

Installs: 9

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2016-08-05 10:26 UTC

This package is auto-updated.

Last update: 2026-03-05 03:39:48 UTC


README

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());