PHP 트레잇 Dimsav\Translatable\Translatable

파일 보기 프로젝트 열기: dimsav/laravel-translatable

공개 메소드들

메소드 설명
__isset ( $key ) : boolean
deleteTranslations ( string | array | null $locales = null ) Deletes all translations for this model.
fill ( array $attributes )
getAttribute ( string $key ) : mixed
getLocaleKey ( ) : string
getNewTranslation ( string $locale ) : Model
getRelationKey ( ) : string
getTranslation ( string | null $locale = null, boolean $withFallback = null ) : Model | null
getTranslationModelName ( ) : string
getTranslationModelNameDefault ( ) : string
hasTranslation ( string | null $locale = null ) : boolean
isTranslationAttribute ( string $key ) : boolean
save ( array $options = [] ) : boolean
scopeListsTranslations ( Builder $query, string $translationField ) Adds scope to get a list of translated attributes, using the current locale.
scopeNotTranslatedIn ( Builder $query, string $locale = null ) : Builder | static
scopeTranslated ( Builder $query ) : Builder | static
scopeTranslatedIn ( Builder $query, string $locale = null ) : Builder | static
scopeWhereTranslation ( Builder $query, string $key, string $value, string $locale = null ) : Builder | static This scope filters results by checking the translation fields.
scopeWhereTranslationLike ( Builder $query, string $key, string $value, string $locale = null ) : Builder | static This scope filters results by checking the translation fields.
scopeWithTranslation ( Builder $query ) This scope eager loads the translations for the default and the fallback locale only.
setAttribute ( string $key, mixed $value )
toArray ( ) : array
translate ( string | null $locale = null, boolean $withFallback = false ) : Model | null Alias for getTranslation().
translateOrDefault ( string $locale ) : Model | null Alias for getTranslation().
translateOrNew ( string $locale ) : Model | null Alias for getTranslationOrNew().
translations ( ) : Illuminate\Database\Eloquent\Relations\HasMany

보호된 메소드들

메소드 설명
getLocaleSeparator ( ) : string
getLocales ( ) : array
getTranslationOrNew ( string $locale ) : Model | null
isKeyALocale ( string $key ) : boolean
isTranslationDirty ( Model $translation ) : boolean
locale ( ) : string
saveTranslations ( ) : boolean

비공개 메소드들

메소드 설명
alwaysFillable ( ) : boolean
getFallbackLocale ( null $locale = null ) : string
getLanguageFromCountryBasedLocale ( $locale ) : string
getTranslationByLocaleKey ( string $key )
getTranslationsTable ( ) : string
isLocaleCountryBased ( $locale ) : boolean
useFallback ( ) : boolean | null

메소드 상세

__isset() 공개 메소드

public __isset ( $key ) : boolean
$key
리턴 boolean

deleteTranslations() 공개 메소드

Deletes all translations for this model.
public deleteTranslations ( string | array | null $locales = null )
$locales string | array | null The locales to be deleted (array or single string) (e.g., ["en", "de"] would remove these translations).

fill() 공개 메소드

public fill ( array $attributes )
$attributes array

getAttribute() 공개 메소드

public getAttribute ( string $key ) : mixed
$key string
리턴 mixed

getLocaleKey() 공개 메소드

public getLocaleKey ( ) : string
리턴 string

getLocaleSeparator() 보호된 메소드

protected getLocaleSeparator ( ) : string
리턴 string

getLocales() 보호된 메소드

protected getLocales ( ) : array
리턴 array

getNewTranslation() 공개 메소드

public getNewTranslation ( string $locale ) : Model
$locale string
리턴 Illuminate\Database\Eloquent\Model

getRelationKey() 공개 메소드

public getRelationKey ( ) : string
리턴 string

getTranslation() 공개 메소드

public getTranslation ( string | null $locale = null, boolean $withFallback = null ) : Model | null
$locale string | null
$withFallback boolean
리턴 Illuminate\Database\Eloquent\Model | null

getTranslationModelName() 공개 메소드

public getTranslationModelName ( ) : string
리턴 string

getTranslationModelNameDefault() 공개 메소드

getTranslationOrNew() 보호된 메소드

protected getTranslationOrNew ( string $locale ) : Model | null
$locale string
리턴 Illuminate\Database\Eloquent\Model | null

hasTranslation() 공개 메소드

public hasTranslation ( string | null $locale = null ) : boolean
$locale string | null
리턴 boolean

isKeyALocale() 보호된 메소드

protected isKeyALocale ( string $key ) : boolean
$key string
리턴 boolean

isTranslationAttribute() 공개 메소드

public isTranslationAttribute ( string $key ) : boolean
$key string
리턴 boolean

isTranslationDirty() 보호된 메소드

protected isTranslationDirty ( Model $translation ) : boolean
$translation Illuminate\Database\Eloquent\Model
리턴 boolean

locale() 보호된 메소드

protected locale ( ) : string
리턴 string

save() 공개 메소드

public save ( array $options = [] ) : boolean
$options array
리턴 boolean

saveTranslations() 보호된 메소드

protected saveTranslations ( ) : boolean
리턴 boolean

scopeListsTranslations() 공개 메소드

Example usage: Country::listsTranslations('name')->get()->toArray() Will return an array with items: [ 'id' => '1', // The id of country 'name' => 'Griechenland' // The translated name ]
public scopeListsTranslations ( Builder $query, string $translationField )
$query Illuminate\Database\Eloquent\Builder
$translationField string

scopeNotTranslatedIn() 공개 메소드

public scopeNotTranslatedIn ( Builder $query, string $locale = null ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
$locale string
리턴 Illuminate\Database\Eloquent\Builder | static

scopeTranslated() 공개 메소드

public scopeTranslated ( Builder $query ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
리턴 Illuminate\Database\Eloquent\Builder | static

scopeTranslatedIn() 공개 메소드

public scopeTranslatedIn ( Builder $query, string $locale = null ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
$locale string
리턴 Illuminate\Database\Eloquent\Builder | static

scopeWhereTranslation() 공개 메소드

This scope filters results by checking the translation fields.
public scopeWhereTranslation ( Builder $query, string $key, string $value, string $locale = null ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
$key string
$value string
$locale string
리턴 Illuminate\Database\Eloquent\Builder | static

scopeWhereTranslationLike() 공개 메소드

This scope filters results by checking the translation fields.
public scopeWhereTranslationLike ( Builder $query, string $key, string $value, string $locale = null ) : Builder | static
$query Illuminate\Database\Eloquent\Builder
$key string
$value string
$locale string
리턴 Illuminate\Database\Eloquent\Builder | static

scopeWithTranslation() 공개 메소드

We can use this as a shortcut to improve performance in our application.
public scopeWithTranslation ( Builder $query )
$query Illuminate\Database\Eloquent\Builder

setAttribute() 공개 메소드

public setAttribute ( string $key, mixed $value )
$key string
$value mixed

toArray() 공개 메소드

public toArray ( ) : array
리턴 array

translate() 공개 메소드

Alias for getTranslation().
public translate ( string | null $locale = null, boolean $withFallback = false ) : Model | null
$locale string | null
$withFallback boolean
리턴 Illuminate\Database\Eloquent\Model | null

translateOrDefault() 공개 메소드

Alias for getTranslation().
public translateOrDefault ( string $locale ) : Model | null
$locale string
리턴 Illuminate\Database\Eloquent\Model | null

translateOrNew() 공개 메소드

Alias for getTranslationOrNew().
public translateOrNew ( string $locale ) : Model | null
$locale string
리턴 Illuminate\Database\Eloquent\Model | null

translations() 공개 메소드

public translations ( ) : Illuminate\Database\Eloquent\Relations\HasMany
리턴 Illuminate\Database\Eloquent\Relations\HasMany