PHP Class RainLab\Translate\Models\Locale

Inheritance: extends Mode\Model, use trait October\Rain\Database\Traits\Validation
显示文件 Open project: rainlab/translate-plugin Class Usage Examples

Public Properties

Property Type Description
$rules Validation rules
$table The database table used by the model.
$timestamps

Protected Properties

Property Type Description
$cacheByCode Object cache of self, by code.
$cacheListAvailable A cache of available locales.
$cacheListEnabled A cache of enabled locales.

Public Methods

Method Description
afterCreate ( )
beforeDelete ( )
beforeUpdate ( )
clearCache ( ) : void Clears all cache keys used by this model
findByCode ( string $code = null ) : Model Locate a locale table by its code, cached.
getDefault ( ) : self Returns the default locale defined.
isAvailable ( ) : boolean Returns true if there are at least 2 locales available.
isValid ( $locale ) : boolean Returns true if the supplied locale is valid.
listAvailable ( ) : array Lists available locales, used on the back-end.
listEnabled ( ) : array Lists the enabled locales, used on the front-end.
makeDefault ( ) : void Makes this model the default
scopeIsEnabled ( Builder $query ) : Builder Scope for checking if model is enabled

Method Details

afterCreate() public method

public afterCreate ( )

beforeDelete() public method

public beforeDelete ( )

beforeUpdate() public method

public beforeUpdate ( )

clearCache() public static method

Clears all cache keys used by this model
public static clearCache ( ) : void
return void

findByCode() public static method

Locate a locale table by its code, cached.
public static findByCode ( string $code = null ) : Model
$code string
return Model

getDefault() public static method

Returns the default locale defined.
public static getDefault ( ) : self
return self

isAvailable() public static method

Returns true if there are at least 2 locales available.
public static isAvailable ( ) : boolean
return boolean

isValid() public static method

Returns true if the supplied locale is valid.
public static isValid ( $locale ) : boolean
return boolean

listAvailable() public static method

Lists available locales, used on the back-end.
public static listAvailable ( ) : array
return array

listEnabled() public static method

Lists the enabled locales, used on the front-end.
public static listEnabled ( ) : array
return array

makeDefault() public method

Makes this model the default
public makeDefault ( ) : void
return void

scopeIsEnabled() public method

Scope for checking if model is enabled
public scopeIsEnabled ( Builder $query ) : Builder
$query Builder
return Builder

Property Details

$cacheByCode protected_oe static_oe property

Object cache of self, by code.
protected static $cacheByCode

$cacheListAvailable protected_oe static_oe property

A cache of available locales.
protected static $cacheListAvailable

$cacheListEnabled protected_oe static_oe property

A cache of enabled locales.
protected static $cacheListEnabled

$rules public_oe property

Validation rules
public $rules

$table public_oe property

The database table used by the model.
public $table

$timestamps public_oe property

public $timestamps