Download the PHP package kiritokatklian/nova-astrotranslatable without Composer
On this page you can find all versions of the php package kiritokatklian/nova-astrotranslatable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kiritokatklian/nova-astrotranslatable
More information about kiritokatklian/nova-astrotranslatable
Files in kiritokatklian/nova-astrotranslatable
Package nova-astrotranslatable
Short Description An astrotomic/laravel-translatable extension for Laravel Nova.
License MIT
Informations about the package nova-astrotranslatable
Nova Astrotomic Translatable
This Laravel Nova allows you to make any input field astrotomic/laravel-translatable compatible and localisable.
Requirements
PHP: >=8.0
laravel/nova: ^4.12
astrotomic/laravel-translatable: ^11.10
Features
- Supports almost all fields (including third party ones)
- 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
- Double click on a tab to switch all fields to that locale
- Supports nova-settings package
Known non-working fields
Image
andFile
- Workarounds:
- outl1ne/nova-media-hub
- or any library that uploads images/files using XHR
Limitations
- The following methods can not be used, as this package uses them internally:
resolveUsing
fillUsing
Screenshots
Installation
Firstly, set up astrotomic/laravel-translatable.
Install the package in a Laravel Nova project via Composer:
Usage
Call ->translatable()
on any field, like so:
Validation
It's possible to define locale specific validation rules.
To do so, add the ->rulesFor()
on your field and the HandlesTranslatable
trait to your Nova resource.
->rulesFor
accepts array|string|callable
locales and array|callable
rules.
In this example, rules will be added to the following values
Configuration
You can define default locales for all the translatable
fields in the config file. The config file can be published using:
Fill other locales from config option
The configuration option fill_other_locales_from
allows you to pre-fill other locales from just one locale. This requires the resources to also have the HandlesTranslatable
trait.
One select for all fields on a page
If you don't want to display the locale select next to each field, you can set the display_type
to none
and add a Kiritokatklian\NovaAstrotranslatable\Fields\LocaleSelect
field to your Nova resource. This will render a single select for all fields.
Edge cases
BelongsToMany allowDuplicateRelations corner-case
When using this field inside a BelongsToMany as a pivot field with ->allowDuplicateRelations()
and you want to filter out exact matches using the NotExactlyAttached
rule, use the BelongsToManyTranslatable
field instead of the regular BelongsToMany
.
Credits
License
This project is open-sourced software licensed under the MIT license.
All versions of nova-astrotranslatable with dependencies
laravel/nova Version ^4.12
nova-kit/nova-packages-tool Version ^1.0
astrotomic/laravel-translatable Version ^11.10