dejwcake/craftable-translatable
Adds multilingual, translatable field support to the Craftable Laravel admin panel, letting you manage content in multiple languages with locale tabs and translation-aware form fields. Simple to install and configure for building multilingual admin interfaces.
composer require <vendor>/<package> and confirm the service provider is auto-discovered; nothing needs publishing for the 2.0.1 upgrade path.Translatable / HasTranslations model trait and TranslatableFormRequest for per-locale validation.TranslatableFormRequest so a single request validates { "en": {...}, "fr": {...} } payloads.$model->toArray() returns the locale-resolved values your API expects.getLocale() resolving from the container (changed in 2.0.1) means locale resolution now follows container bindings — useful when you swap locale services in tests.HasTranslations::toArray() is the boundary your JSON resources sit on. Prefer letting it produce the locale-flattened array and layer API resources on top, rather than re-implementing translation picking in each resource.TranslatableFormRequest and return rules keyed by locale, e.g. ['en' => ['title' => 'required|string']]. Mixing array rules and plain string rules ('email' => 'required|email') is supported — the 2.0.1 guard on the is_array($rule) branch fixes the case where array_search() was previously reached with a string rule.Translatable::getLocales() / config) and drive both validation loops and admin form generation from it, so adding a locale is a one-line change rather than a search-and-replace.TranslatableFormRequest, HasTranslations::toArray() and Translatable::getLocales(). Because PHP allows parameter-type widening in subclasses, untyped overrides are still compatible — but any code that reflects on those closures, or tightly typed overrides that assume no parameter types, should be re-run through the test suite.array_search() in rules() and trigger warnings/errors on PHP 8. If you had silently worked around this (e.g. by splitting translatable and non-translatable rules into separate requests), you can now collapse them into one request.app() vs container: if you have tests that fake or bind the application/locale resolver, HasTranslations::getLocale() now honours the container — expected, but assert locale-dependent output in tests that stub bindings.toArray() and the raw attribute to distinguish "translation missing" from "fallback locale applied"; most confusion comes from fallback configuration rather than the trait itself.laravel DB user). If you develop against these engines, mirror that setup locally rather than assuming MySQL-only behaviour for JSON/column types.How can I help you explore Laravel packages today?