- How do I install dejwcake/craftable-translatable in a Laravel application?
- Install it with Composer using composer require dejwcake/craftable-translatable and let Laravel package discovery register it. The package is additive: you add the HasTranslations trait to the Eloquent model you want to translate and optionally use TranslatableFormRequest for validation. No package migrations or extra service provider wiring are required for the 2.0.1 release.
- Which Laravel and PHP versions does craftable-translatable 2.x support?
- The 2.x line is built for PHP 8.x Laravel applications, but you should confirm the exact constraints in the package composer.json before pinning ^2.0. Check that your oldest supported Laravel app falls inside those declared ranges. The 2.0.1 release notes do not change framework or PHP requirements.
- How do I make an Eloquent model translatable with this package?
- Add the HasTranslations trait to the model that holds your per-locale attributes. The trait integrates with Eloquent's array conversion and locale handling so translated fields can be read and written per locale. You keep your existing storage approach, whether JSON columns or side tables, rather than adopting a new persistence layer.
- How do I add locale tabs to a Craftable admin form?
- Use the package's translation-aware form fields and TranslatableFormRequest within your Craftable admin resource forms. The package provides locale tabs so editors can switch languages while managing the same model. Configure the supported locales through your application's existing locale configuration and verify the form renders each translatable field per locale.
- Do I need database migrations to use craftable-translatable?
- No package migrations are required for the 2.0.1 release, and the package does not impose a new persistence paradigm. It works with the way your application already stores per-locale content, such as JSON columns or translation side tables. You only need the schema your app already uses for multilingual data.
- How does TranslatableFormRequest validate translated fields in Laravel?
- TranslatableFormRequest bridges translatable attributes into Laravel's validator so rules can be applied per locale. Version 2.0.1 adds a defensive is_array() guard before array_search() in rules(), which fixes string-form rules such as required|string|max:255 being passed into an array function. Review any tests that assert on validation error message shape after upgrading.
- Is upgrading to craftable-translatable 2.0.1 safe?
- 2.0.1 is a maintenance release with an explicit statement that there is nothing to do when upgrading: no schema changes, config changes, or deprecations. The changes are internal hardening around closure parameter types, a rules() array guard, and container-based locale resolution. Run your full test suite and locale-specific feature tests as a normal regression step.
- Why did my translatable field validation change after upgrading craftable-translatable?
- The 2.0.1 rules() fix adds an is_array() guard before array_search(), so string rules on translatable fields no longer enter the buggy array path. This is a correctness improvement, but validation output or error message shape may shift for code that unknowingly depended on the old behavior. Grep your form requests for string-form rules on translatable fields and confirm assertions on messages still pass.
- Does craftable-translatable work in queued jobs and artisan commands?
- Version 2.0.1 resolves the locale through the container instead of the app() helper, which improves testability and Octane safety. The container is present in queued jobs and console commands, but the request lifecycle differs, so smoke-test locale resolution in both contexts. Confirm getLocale() returns the expected locale in a job and an artisan command, not only in an HTTP request.
- What are alternatives to craftable-translatable for multilingual Laravel models?
- For general Eloquent model translation, common alternatives include spatie/laravel-translatable and astrotomic/laravel-translatable. This package is specifically aimed at adding locale tabs and translation-aware form fields to the Craftable Laravel admin panel. Choose it when you need Craftable admin integration; choose a general translation package when you only need model-level multilingual attributes.