Translatable Pro is a premium package,
get your license here
On this page
Working with Phrases Outside Filament
to get the translation for the active locale, simply call the translatable attribute
1$model->title
and for relations:
1{{ $book->category->name ?? '' }}
remember to lazy load the phrases when needed especially if you have relationships:
1$books = Book::with(['phrases','cat.phrases'])->get();
set Phrase (create or update)
1$book->setPhrase('New Title '. rand(1,99), 'title');
get a Phrase
1$book->getPhrase('title'),
get all Phrases
1$book->getPhrases('title'),
delete a Phrase
1$book->deletePhrase('title'),
delete all Phrase
1$book->deleteAllPhrase('title'),
Soon:
- whereLocale scope
- fallback phrases or clean the active local as an option