PHPackages                             secretwebmaster/wncms-translatable - 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. secretwebmaster/wncms-translatable

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

secretwebmaster/wncms-translatable
==================================

Make any laravel model translatable

v1.4.1(2mo ago)02413MITPHPPHP ^8.4

Since Sep 8Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/secretwebmaster/wncms-translatable)[ Packagist](https://packagist.org/packages/secretwebmaster/wncms-translatable)[ Docs](https://github.com/secretwebmaster/wncms-translatable)[ RSS](/packages/secretwebmaster-wncms-translatable/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (9)Versions (25)Used By (3)

Wncms Translatable
==================

[](#wncms-translatable)

A Laravel package to add translation capabilities to any Eloquent model by storing translations in a separate table with a polymorphic relationship. Easily manage translations for specified fields in multiple locales.

Features
--------

[](#features)

- Translates specified model fields
- Stores translations in a separate `translations` table
- Polymorphic relationship to support multiple models
- Easy to use with a simple trait

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

[](#installation)

### Step 1. Install the package via Composer:

[](#step-1-install-the-package-via-composer)

```
composer require secretwebmaster/wncms-translatable
```

### Step 2. Publish the migration file:

[](#step-2-publish-the-migration-file)

```
php artisan vendor:publish --provider="Wncms\Translatable\TranslatableServiceProvider" --tag="translatable-migrations"
```

### Step 3. Run the migration to create the `translations` table:

[](#step-3-run-the-migration-to-create-the-translations-table)

```
php artisan migrate
```

### Step 4. Setup your model

[](#step-4-setup-your-model)

Add the `HasTranslations` trait to your model To make any model translatable, simply add the `HasTranslations` trait to your Eloquent model and define the `$translatable` property with the list of fields that should be translatable.

```
