Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitbook/assets GitBook: [master] 2 pages and one asset modified Jul 16, 2019


Total Downloads CircleCI StyleCI ScrutinizerCI Code Climate Code Coverage Latest Version MIT License

Laravel Translatable

If you want to store translations of your models into the database, this package is for you.

This is a Laravel package for translatable models. Its goal is to remove the complexity in retrieving and storing multilingual model instances. With this package you write less code, as the translations are being fetched/saved when you fetch/save your instance.

Quick Example

Getting translated attributes

$post = Post::first();
echo $post->translate('en')->title; // My first post

echo $post->title; // My first post

echo $post->title; // Mein erster Post

Saving translated attributes

$post = Post::first();
echo $post->translate('en')->title; // My first post

$post->translate('en')->title = 'My cool post';

$post = Post::first();
echo $post->translate('en')->title; // My cool post

Filling multiple translations

$data = [
  'author' => 'Gummibeer',
  'en' => ['title' => 'My first post'],
  'fr' => ['title' => 'Mon premier post'],
$post = Post::create($data);

echo $post->translate('fr')->title; // Mon premier post



Package Laravel PHP
v11.4 - v11.5 5.6.* / 5.7.* / 5.8.* / 6.* >=7.1.3
v11.0 - v11.3 5.6.* / 5.7.* / 5.8.* >=7.1.3
You can’t perform that action at this time.