PHP Trait Esensi\Model\Traits\EncryptingModelTrait

See also: Esensi\Model\Contracts\EncryptionModelInterface
Author: Daniel LaBarge ([email protected])
显示文件 Open project: esensi/model

Protected Properties

Property Type Description
$encrypter Illuminate\Encryption\Encrypter The Encrypter to use for encryption.
$encrypting boolean Whether the model is encrypting or not.

Public Methods

Method Description
__get ( string $key ) : mixed Dynamically retrieve attributes.
__set ( string $key, mixed $value ) Dynamically set attributes.
addEncryptable ( string $attribute ) Add an attribute to the encryptable array.
decrypt ( string $value ) : string Return a decrypted string for the value.
encrypt ( string $value ) : string Return an encrypted string for the value.
encryptAttributes ( ) Encrypt attributes that should be encrypted.
getEncryptable ( ) : array Get the encryptable attributes.
getEncryptedAttribute ( string $attribute ) : string Get the decrypted value for an encrypted attribute.
getEncrypter ( ) : Illuminate\Encryption\Encrypter Set the Encrypter to use for encryption.
getEncrypting ( ) : boolean Returns whether or not the model will encrypt attributes when setting and decrypt when getting.
isDecrypted ( string $attribute ) : boolean Returns whether the attribute is decrypted.
isEncryptable ( string $attribute ) : boolean Returns whether the attribute is encryptable.
isEncrypted ( string $attribute ) : boolean Returns whether the attribute is encrypted.
mergeEncryptable ( array $attributes ) Merge an array of attributes with the encryptable array.
removeEncryptable ( string $attribute ) Remove an attribute from the encryptable array.
setEncryptable ( array $attributes ) Set the encryptable attributes.
setEncrypter ( Illuminate\Encryption\Encrypter $encrypter ) Set the Encrypter to use for encryption.
setEncrypting ( $value ) Set whether or not the model will encrypt attributes when setting and decrypt when getting.
setEncryptingAttribute ( string $attribute, string $value ) Set an encrypted value for an encryptable attribute.

Protected Methods

Method Description
getDynamicEncrypted ( string $attribute ) : mixed Get an encrypted attribute dynamically.
setDynamicEncryptable ( string $attribute, mixed $value ) : boolean Set an encryptable attribute dynamically.

Method Details

__get() public method

Dynamically retrieve attributes.
public __get ( string $key ) : mixed
$key string
return mixed

__set() public method

Dynamically set attributes.
public __set ( string $key, mixed $value )
$key string
$value mixed

addEncryptable() public method

Add an attribute to the encryptable array.
public addEncryptable ( string $attribute )
$attribute string to purge

decrypt() public method

Return a decrypted string for the value.
public decrypt ( string $value ) : string
$value string
return string

encrypt() public method

Return an encrypted string for the value.
public encrypt ( string $value ) : string
$value string
return string

encryptAttributes() public method

Encrypt attributes that should be encrypted.
public encryptAttributes ( )

getDynamicEncrypted() protected method

Get an encrypted attribute dynamically.
protected getDynamicEncrypted ( string $attribute ) : mixed
$attribute string
return mixed

getEncryptable() public method

Get the encryptable attributes.
public getEncryptable ( ) : array
return array

getEncryptedAttribute() public method

Get the decrypted value for an encrypted attribute.
public getEncryptedAttribute ( string $attribute ) : string
$attribute string name
return string

getEncrypter() public method

Set the Encrypter to use for encryption.
public getEncrypter ( ) : Illuminate\Encryption\Encrypter
return Illuminate\Encryption\Encrypter

getEncrypting() public method

Returns whether or not the model will encrypt attributes when setting and decrypt when getting.
public getEncrypting ( ) : boolean
return boolean

isDecrypted() public method

Returns whether the attribute is decrypted.
public isDecrypted ( string $attribute ) : boolean
$attribute string name
return boolean

isEncryptable() public method

Returns whether the attribute is encryptable.
public isEncryptable ( string $attribute ) : boolean
$attribute string name
return boolean

isEncrypted() public method

Returns whether the attribute is encrypted.
public isEncrypted ( string $attribute ) : boolean
$attribute string name
return boolean

mergeEncryptable() public method

Merge an array of attributes with the encryptable array.
public mergeEncryptable ( array $attributes )
$attributes array to purge

removeEncryptable() public method

Remove an attribute from the encryptable array.
public removeEncryptable ( string $attribute )
$attribute string to purge

setDynamicEncryptable() protected method

Set an encryptable attribute dynamically.
protected setDynamicEncryptable ( string $attribute, mixed $value ) : boolean
$attribute string
$value mixed
return boolean

setEncryptable() public method

Set the encryptable attributes.
public setEncryptable ( array $attributes )
$attributes array to encrypt

setEncrypter() public method

Set the Encrypter to use for encryption.
public setEncrypter ( Illuminate\Encryption\Encrypter $encrypter )
$encrypter Illuminate\Encryption\Encrypter

setEncrypting() public method

Set whether or not the model will encrypt attributes when setting and decrypt when getting.
public setEncrypting ( $value )

setEncryptingAttribute() public method

Set an encrypted value for an encryptable attribute.
public setEncryptingAttribute ( string $attribute, string $value )
$attribute string name
$value string to encrypt

Property Details

$encrypter protected_oe property

The Encrypter to use for encryption.
protected Encrypter,Illuminate\Encryption $encrypter
return Illuminate\Encryption\Encrypter

$encrypting protected_oe property

Whether the model is encrypting or not.
protected bool $encrypting
return boolean