PHP Trait Esensi\Model\Traits\HashingModelTrait

See also: Esensi\Model\Contracts\HashingModelInterface
Author: Daniel LaBarge ([email protected])
Afficher le fichier Open project: esensi/model

Protected Properties

Свойство Type Description
$hasher Illuminate\Contracts\Hashing\Hasher The Hasher to use for hashing.
$hashing boolean Whether the model is hashing or not.

Méthodes publiques

Méthode Description
addHashable ( string $attribute ) Add an attribute to the hashable array.
bootHashingModelTrait ( ) Boot the trait's observers.
checkHash ( string $value, string $hash ) : boolean Return whether a plain value matches a hashed value.
getHashable ( ) : array Get the hashable attributes.
getHasher ( ) : Illuminate\Contracts\Hashing\Hasher Set the Hasher to use for hashing.
getHashing ( ) : boolean Returns whether or not the model will hash attributes before saving.
hash ( string $value ) : string Return a hashed string for the value.
hashAttributes ( ) Hash attributes that should be hashed.
isHashable ( string $attribute ) : boolean Returns whether the attribute is hashable.
isHashed ( string $attribute ) : boolean Returns whether the attribute is hashed.
mergeHashable ( array $attributes ) Merge an array of attributes with the hashable array.
removeHashable ( string $attribute ) Remove an attribute from the hashable array.
saveWithHashing ( ) : boolean Save with hashing even if hashing is disabled.
saveWithoutHashing ( ) : boolean Save without hashing even if hashing is enabled.
setHashable ( array $attributes ) Set the hashable attributes.
setHasher ( Illuminate\Contracts\Hashing\Hasher $hasher ) Set the Hasher to use for hashing.
setHashing ( $value ) Set whether or not the model will hash attributes before saving.
setHashingAttribute ( string $attribute, string $value ) Set a hashed value for a hashable attribute.

Méthodes protégées

Méthode Description
setHashingAndSave ( boolean $hash ) : boolean Set hashing state and then save and then reset it.

Method Details

addHashable() public méthode

Add an attribute to the hashable array.
public addHashable ( string $attribute )
$attribute string to hash

bootHashingModelTrait() public static méthode

Boot the trait's observers.
public static bootHashingModelTrait ( )

checkHash() public méthode

Return whether a plain value matches a hashed value.
public checkHash ( string $value, string $hash ) : boolean
$value string
$hash string to compare to
Résultat boolean

getHashable() public méthode

Get the hashable attributes.
public getHashable ( ) : array
Résultat array

getHasher() public méthode

Set the Hasher to use for hashing.
public getHasher ( ) : Illuminate\Contracts\Hashing\Hasher
Résultat Illuminate\Contracts\Hashing\Hasher

getHashing() public méthode

Returns whether or not the model will hash attributes before saving.
public getHashing ( ) : boolean
Résultat boolean

hash() public méthode

Return a hashed string for the value.
public hash ( string $value ) : string
$value string
Résultat string

hashAttributes() public méthode

Hash attributes that should be hashed.
public hashAttributes ( )

isHashable() public méthode

Returns whether the attribute is hashable.
public isHashable ( string $attribute ) : boolean
$attribute string name
Résultat boolean

isHashed() public méthode

Returns whether the attribute is hashed.
public isHashed ( string $attribute ) : boolean
$attribute string name
Résultat boolean

mergeHashable() public méthode

Merge an array of attributes with the hashable array.
public mergeHashable ( array $attributes )
$attributes array to hash

removeHashable() public méthode

Remove an attribute from the hashable array.
public removeHashable ( string $attribute )
$attribute string to hash

saveWithHashing() public méthode

Save with hashing even if hashing is disabled.
public saveWithHashing ( ) : boolean
Résultat boolean

saveWithoutHashing() public méthode

Save without hashing even if hashing is enabled.
public saveWithoutHashing ( ) : boolean
Résultat boolean

setHashable() public méthode

Set the hashable attributes.
public setHashable ( array $attributes )
$attributes array to hash

setHasher() public méthode

Set the Hasher to use for hashing.
public setHasher ( Illuminate\Contracts\Hashing\Hasher $hasher )
$hasher Illuminate\Contracts\Hashing\Hasher

setHashing() public méthode

Set whether or not the model will hash attributes before saving.
public setHashing ( $value )

setHashingAndSave() protected méthode

Set hashing state and then save and then reset it.
protected setHashingAndSave ( boolean $hash ) : boolean
$hash boolean
Résultat boolean

setHashingAttribute() public méthode

Set a hashed value for a hashable attribute.
public setHashingAttribute ( string $attribute, string $value )
$attribute string name
$value string to hash

Property Details

$hasher protected_oe property

The Hasher to use for hashing.
protected Hasher,Illuminate\Contracts\Hashing $hasher
Résultat Illuminate\Contracts\Hashing\Hasher

$hashing protected_oe property

Whether the model is hashing or not.
protected bool $hashing
Résultat boolean