PHPackages                             guidocella/laravel-multilingual - 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. guidocella/laravel-multilingual

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

guidocella/laravel-multilingual
===============================

Easy multilingual Laravel models

v1.0.8(1mo ago)2174↓100%1MITPHP

Since Sep 13Pushed 8mo agoCompare

[ Source](https://github.com/guidocella/laravel-multilingual)[ Packagist](https://packagist.org/packages/guidocella/laravel-multilingual)[ Docs](https://github.com/guidocella/laravel-multilingual)[ RSS](/packages/guidocella-laravel-multilingual/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (1)

Laravel Multilingual Models
===========================

[](#laravel-multilingual-models)

Make Eloquent model attributes translatable without separate database tables for translation values.

Simply access `$country->name` and you get a value based on your application's current locale.

`$country->nameTranslations->en` will be the value of a specific locale.

You can get all the translations of a given attributes with `$country->nameTranslations->toArray()`.

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

[](#installation)

Install the package through Composer:

```
composer require guidocella/laravel-multilingual
```

Then publish the config file:

```
php artisan vendor:publish
```

Usage
-----

[](#usage)

First make sure that the translatable attributes' field type is `text` or `json`. If you are building the database from a migration file you may do this:

```
