PHPackages                             themsaid/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. [Localization &amp; i18n](/categories/localization)
4. /
5. themsaid/laravel-multilingual

AbandonedArchivedLibrary[Localization &amp; i18n](/categories/localization)

themsaid/laravel-multilingual
=============================

Easy multilingual laravel models

v1.0.2(8y ago)17920.0k13MITPHPPHP &gt;=5.3.0

Since Feb 18Pushed 6y ago9 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

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

[](#laravel-5-multilingual-models)

[![Latest Version on Packagist](https://camo.githubusercontent.com/89db5f2193c18bf15b8a93090f56a566834aca96e21524037d54f8d9135929e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656d736169642f6c61726176656c2d6d756c74696c696e6775616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/themsaid/laravel-multilingual)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/e8de4530f31ec3ca81cd7940481f53d662b5b8b0d7b33d610cbb3aa2b467ff69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468656d736169642f6c61726176656c2d6d756c74696c696e6775616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/themsaid/laravel-multilingual)

This laravel package makes Eloquent Models attributes translatable without the need to separate database tables for translation values.

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

You can also call `$country->nameTranslations->en` to get the value of a specific locale.

You can check all the translations of a given attributes as easy as `$country->nameTranslations->toArray()`.

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

[](#installation)

Begin by installing the package through Composer. Run the following command in your terminal:

```
composer require themsaid/laravel-multilingual

```

Once composer is done, add the package service provider in the providers array in `config/app.php`

```
Themsaid\Multilingual\MultilingualServiceProvider::class

```

Finally publish the config file:

```
php artisan vendor:publish

```

That's all, you are now good to go.

Usage
=====

[](#usage)

First you need to make sure that the translatable attributes has a mysql field type of text or json, if you are building the database from a migration file you may do this:

```
