parfumix/eloquent-translatable
Larablocks Analysis
parfumix/eloquent-translatable works with Laravel 5 (latest release v1.1, Aug 25, 2015), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Aug 25, 2015)
- 0 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Aug 25, 2015.
- No releases in the last 12 months.
- First released: Aug 25, 2015.
- 1 open issue on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.
| Install | |
|---|---|
composer require parfumix/eloquent-translatable |
|
| Latest Version: | v1.1 |
| PHP: | >=5.4.0 |
| Laravel: | 5 |
| License: | MIT |
| Last Updated: | Oct 15, 2015 |
| Links: | GitHub · Packagist |
##Introduction
Eloquent translatable allow you easy to translate your eloquent models in different languages. This package working strongly with https://github.com/parfumix/laravel-localization and install that package.
So before start working under eloquent translatable please study how to implement localization on your website.
Instalation
You can use the composer package manager to install. From console run:
$ php composer.phar require parfumix/eloquent-translatable "v1.0"
or add to your composer.json file
"parfumix/eloquent-translatable": "v1.0"
##Basic usage
Before stary working with translatable package you have implement Translatable contract on your eloquent model and use TranslatableTrait .
<?php
namespace App;
use Eloquent\Translatable\Translatable;
use Eloquent\Translatable\TranslatableTrait;
use Illuminate\Database\Eloquent\Model;
// Create page model .
class Page extends Model implements Translatable {
use TranslatableTrait;
// That attribute is not required, will try to detect class name. If you have one custom you can do it.
protected $translationClass = PageTranslations::class;
}
// Create translation model for page .
class PageTranslations extends Model {
public $timestamps = false;
protected $fillable = ['page_id', 'language_id', 'title', 'description'];
}
and create translation model for you eloquent model.
##How to use
// Wil create and page and their translations
Page::create([
'slug' => 'title-slug',
'en' => [ 'title' => 'English title', 'description' => 'English description' ],
'ru' => [ 'title' => 'Russian title', 'description' => 'Russian description' ]
]);
// Will access Page translation instance
Page::first()->translate('en')
// will access translate title in english
Page::first()->translate('en')->title
// Will check if page have translation in english
Page::first()->hasTranslation('en')
// Will delete english translation for current page
Page::first()->removeTranslation('en')
// Will return all translation for current page instance
Page::first()->translations
Related Packages
A simple drop-in solution for providing UUID support for the IDs of your Eloquen...
A simple package for using UUID's (UUID4) with Laravel's Eloquent.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v1.1 | >=5.4.0 | ~5.0 | MIT | |
| v1.0 | >=5.4.0 | ~5.0 | MIT |