This Laravel Nova field allows you to manage translated fields with astrotomic/laravel-translatable.
laravel/nova: ^2.9 || ^3.0
astrotomic/laravel-translatable: ^11.0
waynestate/nova-ckeditor4-field: ^0.6.0
- Supports almost all Nova fields
- Supports default validation automatically
- Simple to implement with minimal code changes (after astrotomic/laravel-translatable support)
- Locale tabs to switch between different locale values of the same field
- Code
- Counted text (with max char and warning treshold)
- CKEditor
- Json
- Sluggable
- Text (also single line)
- Textarea
- Trix
Firstly, set up astrotomic/laravel-translatable.
Install the package in a Laravel Nova project via Composer:
# Install nova-translatable
composer require rslanzi/nova-translatable
# Publish configuration (optional, but useful for setting default locales)
php artisan vendor:publish --tag="nova-translatable-config"
Single line text field
NovaTranslatable::make('Title')
->singleLine()
Multi line text field
NovaTranslatable::make('Text')
->hideFromIndex()
Text field with chars counter
NovaTranslatable::make('Title')
->singleLine()
->counted()
Exceeded the threshold, the counter turns red.
NovaTranslatable::make('Title')
->singleLine()
->counted()
->maxChars(60)
->warningAt(50),
Exceeded the warning threshold, the counter turns orange, exceeded the max chars threshold, the counter turns red.
NovaTranslatable::make('Title')
->singleLine()
->counted()
->maxChars(60)
->warningAt(50),
CKEditor WYSIWYG editor. Usefull to manage HTML fields.
NovaTranslatable::make('Text')
->ckeditor()
Trix field
NovaTranslatable::make('Text')
->trix()
Automatically populate a slug field based on another field. Title in this case.
NovaTranslatable::make('Title')
->sluggable('Slug'),
NovaTranslatableSlug::make('Slug')
->hideFromIndex(),
Code field. Use a syntax highlighted text area.
NovaTranslatable::make('Text')
->code()
Code field. Use a syntax highlighted text area.
NovaTranslatable::make('Text')
->code()
->language('php')
The Code field's currently supported languages are: dockerfile, javascript, markdown, nginx, php, ruby, sass, shell, vue, xml, yaml
NovaTranslatable::make('Text')
->json()
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Do you like this project? Support it by donating
- PayPal: Donate
If you discover a security vulnerability within Nova Translatable, please send an e-mail to Riccardo Slanzi at [email protected]. All security vulnerabilities will be promptly addressed.
Nova Translatable is free software distributed under the terme of the MIT license.