Registry / database / spatie-laravel-translatable

spatie-laravel-translatable

JSON →
library6.14.1phppackagistunverified

A trait to make an Eloquent model hold translations

composer require spatie/laravel-translatable
INSTALL
IMPORT
SIG · SPATIE-LARAVEL-TRA
S
spatie-laravel-translatable
databasephpv6.14.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HasTranslations
use Spatie\Translatable\HasTranslations;

Add translatable fields to an Eloquent model.

use Spatie\Translatable\HasTranslations; class Product extends \Illuminate\Database\Eloquent\Model { use HasTranslations; public $translatable = ['name']; } $product = new Product(); $product->setTranslation('name', 'en', 'Product Name'); $product->save();
Debug
Known issues
breakingRequires Laravel 5.6+ and PHP 7.0+.
fix
Upgrade Laravel or PHP to meet requirements.
affects: <6.0
Upgrade
Version history
6.14.1latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
8
Meta
1
Amazon
1
Resources
spatie-laravel-translatable — pip install spatie-laravel-translatable · libregistry