translatable-development
Installation
SKILL.md
spatie/laravel-translatable
Translations are stored as JSON on the model itself. No extra tables, no pivot.
Making a model translatable
Declare translatable attributes via the #[Translatable] PHP attribute (preferred) and add the HasTranslations trait.
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\Attributes\Translatable;
use Spatie\Translatable\HasTranslations;
#[Translatable('name', 'description')]
class NewsItem extends Model
{
use HasTranslations;
}