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

ActiveLibrary

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

Make any laravel model translatable

v1.3.2(3mo ago)0221↓100%2MITPHPPHP ^8.2

Since Sep 8Pushed 3mo 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 1mo ago

READMEChangelog (1)Dependencies (4)Versions (23)Used By (2)

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 --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.

```
