PHP Trait Mpociot\Versionable\VersionableTrait

Afficher le fichier Open project: mpociot/versionable

Protected Properties

Свойство Type Description
$versioningEnabled boolean Flag that determines if the model allows versioning at all

Méthodes publiques

Méthode Description
bootVersionableTrait ( ) Initialize model events
currentVersion ( ) : Version Returns the latest version available
disableVersioning ( )
enableVersioning ( )
getVersionModel ( $version_id ) Get a model based on the version id
previousVersion ( ) : Version Returns the previous version
setReasonAttribute ( string $value ) Attribute mutator for "reason" Prevent "reason" to become a database attribute of model
versions ( ) : Illuminate\Database\Eloquent\Relations\MorphMany Return all versions of the model

Méthodes protégées

Méthode Description
getAuthUserId ( ) : integer | null
versionablePostSave ( ) : void Save a new version.
versionablePreSave ( ) : void Pre save hook to determine if versioning is enabled and if we're updating the model

Private Methods

Méthode Description
isValidForVersioning ( ) : boolean Determine if a new version should be created for this model.

Method Details

bootVersionableTrait() public static méthode

Initialize model events
public static bootVersionableTrait ( )

currentVersion() public méthode

Returns the latest version available
public currentVersion ( ) : Version
Résultat Version

disableVersioning() public méthode

public disableVersioning ( )

enableVersioning() public méthode

public enableVersioning ( )

getAuthUserId() protected méthode

protected getAuthUserId ( ) : integer | null
Résultat integer | null

getVersionModel() public méthode

Get a model based on the version id
public getVersionModel ( $version_id )
$version_id

previousVersion() public méthode

Returns the previous version
public previousVersion ( ) : Version
Résultat Version

setReasonAttribute() public méthode

Attribute mutator for "reason" Prevent "reason" to become a database attribute of model
public setReasonAttribute ( string $value )
$value string

versionablePostSave() protected méthode

Save a new version.
protected versionablePostSave ( ) : void
Résultat void

versionablePreSave() protected méthode

Pre save hook to determine if versioning is enabled and if we're updating the model
protected versionablePreSave ( ) : void
Résultat void

versions() public méthode

Return all versions of the model
public versions ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
Résultat Illuminate\Database\Eloquent\Relations\MorphMany

Property Details

$versioningEnabled protected_oe property

Flag that determines if the model allows versioning at all
protected bool $versioningEnabled
Résultat boolean