PHP code example of visual-ideas / moonshine-spatie-translatable

1. Go to this page and download the library: Download visual-ideas/moonshine-spatie-translatable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

visual-ideas / moonshine-spatie-translatable example snippets


// config/app.php
'providers' => [
    VI\MoonShineSpatieTranslatable\ServiceProvider::class,
],

use VI\MoonShineSpatieTranslatable\Fields\Translatable;

// In your MoonShine resource fields() method:
Translatable::make('Title', 'name')

Translatable::make('Title', 'name')
    ->languages(['lv', 'en', 'ru'])

Translatable::make('Title', 'name')
    ->

Translatable::make('Title', 'name')
    ->priorityLanguages([
        config('app.fallback_locale'),
        config('app.locale'),
        'de', 'fr',
    ])

Translatable::make('Description', 'description')
    ->textarea()

Translatable::make('Body', 'body')
    ->tinyMce()

Translatable::make('Metadata', 'metadata')
    ->json()

Translatable::make('Code', 'code')
    ->customInputField(CodeField::class)

Translatable::make('Title', 'name')
    ->compact()

Translatable::make('Field', 'field')
    ->removable()
shell
php artisan vendor:publish --tag=moonshine-spatie-translatable-assets