PHP code example of kpebedko22 / filament-translation

1. Go to this page and download the library: Download kpebedko22/filament-translation 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/ */

    

kpebedko22 / filament-translation example snippets


TextInput::make('title')
    ->label(__('filament/resource/example.common.title'))
    ->placeholder(__('filament/resource/example.placeholder.title')),

use Filament\Resources\Resource;
use Kpebedko22\FilamentTranslation\Traits\Translatable;

class ExampleResource extends Resource
{
    use Translatable;

    public static function translation(): FilamentTranslation
    {
        return FilamentTranslation::make(static::class, 'example');
    }
    
    public static function form(Form $form): Form
    {
        return $form
            ->schema(self::trans([
                Forms\Components\TextInput::make('title'),
                Forms\Components\TextInput::make('slug'),
                Forms\Components\Textarea::make('description'),
            ]));
    }
    
    public static function table(Table $table): Table
    {
        return $table
            ->columns(self::trans([
                Tables\Columns\TextColumn::make('title'),
            ]))
            ->filters(self::trans([
                Tables\Filters\SelectFilter::make('author_id'),
            ]))
            ->actions([])
            ->bulkActions([]);
    }
}
shell
php artisan vendor:publish --tag=filament-translation-config