kpebedko22/filament-translation
最新稳定版本:v1.0.0
Composer 安装命令:
composer require kpebedko22/filament-translation
包简介
Package for simply translate filament components.
README 文档
README
Installation
Install package with composer:
composer require kpebedko22/filament-translation
Publish config:
php artisan vendor:publish --tag=filament-translation-config
Usage
Main purpose is using in filament resources and relation managers. To avoid duplicating of calling label
and placeholder methods with passing similar parameters.
TextInput::make('title') ->label(__('filament/resource/example.common.title')) ->placeholder(__('filament/resource/example.placeholder.title')),
Filament Resource
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([]); } }
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-29