PHP Трейт Venturecraft\Revisionable\RevisionableTrait

(c) Venture Craft
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$dirtyData array Keeps the list of values that have been updated

Открытые методы

Метод Описание
boot ( ) Ensure that the bootRevisionableTrait is called only if the current installation is a laravel 4 installation Laravel 5 will call bootRevisionableTrait() automatically
bootRevisionableTrait ( ) Create the event listeners for the saving and saved events This lets us save revisions whenever a save is made, no matter the http method.
classRevisionHistory ( integer $limit = 100, string $order = 'desc' ) : mixed Generates a list of the last $limit revisions made to any objects of the class it is being called from.
disableRevisionField ( mixed $field ) : void Disable a revisionable field temporarily Need to do the adding to array longhanded, as there's a PHP bug https://bugs.php.net/bug.php?id=42030
getRevisionFormattedFieldNames ( ) : mixed
getRevisionFormattedFields ( ) : mixed
getRevisionNullString ( ) : string Revision Unknown String When displaying revision history, when a foreign key is updated instead of displaying the ID, you can choose to display a string of your choice, just override this method in your model By default, it will fall back to the models ID.
getRevisionUnknownString ( ) : string No revision string When displaying revision history, if the revisions value cant be figured out, this is used instead.
getSystemUserId ( ) Attempt to find the user id of the currently logged in user Supports Cartalyst Sentry/Sentinel based authentication, as well as stock Auth
identifiableName ( ) : string Identifiable Name When displaying revision history, when a foreign key is updated instead of displaying the ID, you can choose to display a string of your choice, just override this method in your model By default, it will fall back to the models ID.
postCreate ( ) Called after record successfully created
postDelete ( ) If softdeletes are enabled, store the deleted time
postSave ( ) : void Called after a model is successfully saved.
preSave ( ) : boolean Invoked before a model is saved. Return false to abort the operation.
revisionHistory ( ) : mixed

Приватные методы

Метод Описание
changedRevisionableFields ( ) : array Get all of the changes that have been made, that are also supposed to have their changes recorded
isRevisionable ( string $key ) : boolean Check if this field should have a revision kept
isSoftDelete ( ) : boolean Check if soft deletes are currently enabled on this model

Описание методов

boot() публичный статический Метод

Ensure that the bootRevisionableTrait is called only if the current installation is a laravel 4 installation Laravel 5 will call bootRevisionableTrait() automatically
public static boot ( )

bootRevisionableTrait() публичный статический Метод

Create the event listeners for the saving and saved events This lets us save revisions whenever a save is made, no matter the http method.
public static bootRevisionableTrait ( )

classRevisionHistory() публичный статический Метод

Generates a list of the last $limit revisions made to any objects of the class it is being called from.
public static classRevisionHistory ( integer $limit = 100, string $order = 'desc' ) : mixed
$limit integer
$order string
Результат mixed

disableRevisionField() публичный Метод

Disable a revisionable field temporarily Need to do the adding to array longhanded, as there's a PHP bug https://bugs.php.net/bug.php?id=42030
public disableRevisionField ( mixed $field ) : void
$field mixed
Результат void

getRevisionFormattedFieldNames() публичный Метод

public getRevisionFormattedFieldNames ( ) : mixed
Результат mixed

getRevisionFormattedFields() публичный Метод

public getRevisionFormattedFields ( ) : mixed
Результат mixed

getRevisionNullString() публичный Метод

Revision Unknown String When displaying revision history, when a foreign key is updated instead of displaying the ID, you can choose to display a string of your choice, just override this method in your model By default, it will fall back to the models ID.
public getRevisionNullString ( ) : string
Результат string an identifying name for the model

getRevisionUnknownString() публичный Метод

It can be overridden.
public getRevisionUnknownString ( ) : string
Результат string an identifying name for the model

getSystemUserId() публичный Метод

Attempt to find the user id of the currently logged in user Supports Cartalyst Sentry/Sentinel based authentication, as well as stock Auth
public getSystemUserId ( )

identifiableName() публичный Метод

Identifiable Name When displaying revision history, when a foreign key is updated instead of displaying the ID, you can choose to display a string of your choice, just override this method in your model By default, it will fall back to the models ID.
public identifiableName ( ) : string
Результат string an identifying name for the model

postCreate() публичный Метод

Called after record successfully created
public postCreate ( )

postDelete() публичный Метод

If softdeletes are enabled, store the deleted time
public postDelete ( )

postSave() публичный Метод

Called after a model is successfully saved.
public postSave ( ) : void
Результат void

preSave() публичный Метод

Invoked before a model is saved. Return false to abort the operation.
public preSave ( ) : boolean
Результат boolean

revisionHistory() публичный Метод

public revisionHistory ( ) : mixed
Результат mixed

Описание свойств

$dirtyData защищенное свойство

Keeps the list of values that have been updated
protected array $dirtyData
Результат array