PHPackages                             paschaldev/eloquent-translate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. paschaldev/eloquent-translate

ActiveLibrary[Database &amp; ORM](/categories/database)

paschaldev/eloquent-translate
=============================

A package for translating Laravel models with ease.

v0.0.3(7y ago)041MITPHP

Since Nov 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/paschaldev/eloquent-translate)[ Packagist](https://packagist.org/packages/paschaldev/eloquent-translate)[ RSS](/packages/paschaldev-eloquent-translate/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (5)Used By (0)

A package to translate Laravel eloquent Models easily
=====================================================

[](#a-package-to-translate-laravel-eloquent-models-easily)

This package serves as the complete solution to handling translations in a laravel application for data stored in the database. Translations for every model are stored in a database table. By default, automatic translation is enabled. Automatic translation uses third party provider(s) to translate your database attributes, the default for now is Google Translate API. If you choose not to use a third party translation service, you can also manually set your translation for any model.

Installation
------------

[](#installation)

You can install easily via composer.

```
composer install paschaldev/eloquent-translate

```

The package will automatically register itself for supported laravel versions, if not, you should add this to your providers array in `config/app.php`

```
PaschalDev\EloquentTranslate\Providers\TranslateServiceProvider::class,
```

Then after that you can publish

```
php artisan vendor:publish --provider="PaschalDev\EloquentTranslate\Providers\TranslateServiceProvider"
```

This will copy the configuration to your config path.

For Lumen, open your `bootstrap/app.php` and add this line to register a provider

```
$app->register(PaschalDev\EloquentTranslate\Providers\TranslateServiceProvider::class);
```

And this line to setup configuration

```
$app->configure('eloquent-translate');
```

Then run `php artisan migrate` to create the translations table. The default table name is `translations` but you can override this value in the configuration file.

Setup
-----

[](#setup)

In order to make a model translatable, you need to include the trait in your model and also set the `translateAttributes` property. This properties are the attributes you wish to translate in that particukar DB column.

```
