spatie/laravel-translatable
Adds HasTranslations to Eloquent models to store translations in JSON columns—no extra tables. Define translatable attributes via PHP 8 attribute or $translatable property, then set/get per-locale values while model accessors return the current app locale.
Right after calling setTranslation the Spatie\Translatable\Events\TranslationHasBeenSetEvent-event will be fired.
This is how that event looks like:
namespace Spatie\Translatable\Events;
class TranslationHasBeenSetEvent
{
public function __construct(
public mixed $model,
public string $key,
public string $locale,
public mixed $oldValue,
public mixed $newValue,
) {
//
}
}
How can I help you explore Laravel packages today?