filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.1k stars 2.83k forks source link

AttachAction select cannot translate. #9490

Closed NaungYeHtet closed 10 months ago

NaungYeHtet commented 10 months ago

Package

filament/spatie-laravel-translatable-plugin

Package Version

3.0.0

Laravel Version

10.10

Livewire Version

No response

PHP Version

8.1

Problem description

recordSelect field of AttachAction cannot translate.

image

Expected behavior

AttachAction can translate

Steps to reproduce

Use RelationManager AttachAction and filament/spatie-laravel-translatable-plugin

Reproduction repository

https://github.com/NaungYeHtet/filament-naungyehtet

Relevant log output

No response

tuyenhv007 commented 10 months ago

Forms\Components\Select::make('company_city_id') ->relationship('city', 'name') ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->getTranslation('name', app()->getLocale())}") ->preload() ->searchable() ->required(), Is it what you need?

danharrin commented 10 months ago

Or even ->getOptionLabelFromRecordUsing(fn (Model $record) => $record->name)