Translations
trait Translations
Translations trait
Properties
protected string|null | $currentLanguage | Current language |
Methods
static void
bootTranslations()
Boot trait.
string
getCurrentLanguage()
Get current language
string|null
translateAttribute(string $attribute, string|null $language = null)
Return translated value
bool
translateAttributes(string $language)
Translate attributes
array
getTranslatedAttributes()
Get translation attributes
string|null
getTranslationReferenceAttributeName()
Get translation refernce attribute name
string|null
getTranslationModelClass()
Get translation miodel class
Relation|null
translations()
HasMany relation
Builder
getTranslationsQuery(string|null $language = null)
Get translations query
Model|false
translation(string|null $language = null, bool $query = false)
Get translation model
Model|false
saveTranslation(array $data, string|null $language = null, string|integer|null $id = null)
Create or update translation
bool
removeTranslation(string|integer|null $id = null, string|null $language = null)
Delete translation
bool
removeTranslations(string|integer|null $id = null)
Delete all translations
Model|null
findTranslation(string $attributeName, mixed $value, string|null $language = null)
Find Translation
array
getMetaTags(string|null $language = null, array|null $default = [])
Get meta tags values
Details
at line 31
static void
bootTranslations()
Boot trait.
at line 44
string
getCurrentLanguage()
Get current language
at line 56
string|null
translateAttribute(string $attribute, string|null $language = null)
Return translated value
at line 74
bool
translateAttributes(string $language)
Translate attributes
at line 95
array
getTranslatedAttributes()
Get translation attributes
at line 105
string|null
getTranslationReferenceAttributeName()
Get translation refernce attribute name
at line 115
string|null
getTranslationModelClass()
Get translation miodel class
at line 125
Relation|null
translations()
HasMany relation
at line 136
Builder
getTranslationsQuery(string|null $language = null)
Get translations query
at line 152
Model|false
translation(string|null $language = null, bool $query = false)
Get translation model
at line 169
Model|false
saveTranslation(array $data, string|null $language = null, string|integer|null $id = null)
Create or update translation
at line 195
bool
removeTranslation(string|integer|null $id = null, string|null $language = null)
Delete translation
at line 210
bool
removeTranslations(string|integer|null $id = null)
Delete all translations
at line 226
Model|null
findTranslation(string $attributeName, mixed $value, string|null $language = null)
Find Translation
at line 243
array
getMetaTags(string|null $language = null, array|null $default = [])
Get meta tags values