Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to assign a default value to a Text field inside Translatable #109

Open
MarcoImpellizzeri opened this issue Jan 9, 2025 · 0 comments

Comments

@MarcoImpellizzeri
Copy link

MarcoImpellizzeri commented Jan 9, 2025

Hello,

i am using the Translatable field in my nova resource:

Translatable::make([
        Text::make(__('Title'), 'title')
          ->rules('max:35')
          ->required(),
        Textarea::make(__('Message'), 'message')
          ->rules('max:120')
          ->required()
          ->alwaysShow()
      ])

Is it possible to assign a default value (one for every language) to the Text field?

Translatable::make([
        Text::make(__('Title'), 'title')
          ->default(/* HERE */)
          ->rules('max:35')
          ->required(),
        Textarea::make(__('Message'), 'message')
          ->rules('max:120')
          ->required()
          ->alwaysShow()
      ])

Could you please provide guidance or suggest how to achieve this functionality?

Thank you!

@MarcoImpellizzeri MarcoImpellizzeri changed the title Feature Request: Access to the Current Language Code in Translatable Fields How to access to the Current Language Code in Translatable Fields Jan 9, 2025
@MarcoImpellizzeri MarcoImpellizzeri changed the title How to access to the Current Language Code in Translatable Fields How to assign a default value to a Text field inside Translatable Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant