PHP Trait Waavi\Translation\Traits\Translatable

Afficher le fichier Open project: waavi/translation

Méthodes publiques

Méthode Description
attributesToArray ( ) : array Extend parent's attributesToArray so that _translation attributes do not appear in array, and translatable attributes are translated.
bootTranslatable ( ) : void Register Model observer.
getAttribute ( $attribute ) : mixed Hijack parent's getAttribute to get the translation of the given field instead of its value.
getRawAttribute ( $attribute )
isTranslatable ( $attribute ) : boolean Check if an attribute is translatable.
isTranslated ( string $attribute ) : boolean Check if a translation exists for the given attribute.
rawValueRequested ( string $attribute ) : boolean Check if the attribute being queried is the raw value of a translatable attribute.
setAttribute ( string $attribute, string $value ) : void Hijack Eloquent's setAttribute to create a Language Entry, or update the existing one, when setting the value of this attribute.
translatableAttributes ( ) : array Return the translatable attributes array
translate ( string $attribute ) : Translation Return the translation related to a translatable attribute.
translationCodeFor ( string $attribute ) : string Get the set translation code for the give attribute

Method Details

attributesToArray() public méthode

@return array
public attributesToArray ( ) : array
Résultat array

bootTranslatable() public static méthode

@return void
public static bootTranslatable ( ) : void
Résultat void

getAttribute() public méthode

@param string $key Attribute name
public getAttribute ( $attribute ) : mixed
Résultat mixed

getRawAttribute() public méthode

public getRawAttribute ( $attribute )
$attribute

isTranslatable() public méthode

@return boolean
public isTranslatable ( $attribute ) : boolean
Résultat boolean

isTranslated() public méthode

@param string $attribute
public isTranslated ( string $attribute ) : boolean
$attribute string
Résultat boolean

rawValueRequested() public méthode

@param string $attribute
public rawValueRequested ( string $attribute ) : boolean
$attribute string
Résultat boolean

setAttribute() public méthode

@param string $attribute Attribute name
public setAttribute ( string $attribute, string $value ) : void
$attribute string
$value string Text value in default locale. @return void
Résultat void

translatableAttributes() public méthode

@return array
public translatableAttributes ( ) : array
Résultat array

translate() public méthode

@param string $attribute
public translate ( string $attribute ) : Translation
$attribute string
Résultat Translation

translationCodeFor() public méthode

@param string $attribute
public translationCodeFor ( string $attribute ) : string
$attribute string
Résultat string