Installation
Install Lara Zeus Translatable Pro by running the following commands in your Laravel project directory.
1composer require lara-zeus/translatable-pro
then run the installation command:
1php artisan translatable-pro:install
The install command will publish the migrations and the config file.
Register Translatable Pro with Filament:
To set up the plugin with filament, you need to add it to your panel provider; The default one is adminPanelProvider
1->plugins([2 TranslatableProPlugin::make(),3])
Add Translatable Pro trait to your Model
add HasPhrases trait to your translatable model:
1use \LaraZeus\TranslatablePro\Models\Concerns\HasPhrases;
to defined the translatable attributes, set the cast for your attribute:
1protected $casts = [2 'title' => PhrasesCast::class,3 'desc' => PhrasesCast::class,4];
Manually publish and migrate the database
After you have installed the package, you need to publish the database migrations and migrate the database.
run the following command to publish the migrations:
1php artisan vendor:publish --provider="LaraZeus\TranslatablePro\TranslatableProServiceProvider" --tag="zeus-translatable-pro-migrations"
run the following command to migrate the database:
1php artisan migrate
Existing Apps:
now you all done, if you're installing on an existing app you can run the following command, which will move all the data to the phrases table, and you can safely delete the translatable attributes (title,desc)
1zeus-translatable-pro:setup Book