PHP Class Venturecraft\Revisionable\Revision

Base model to allow for revision history on any model that extends this model (c) Venture Craft
Inheritance: extends Illuminate\Database\Eloquent\Model
Afficher le fichier Open project: venturecraft/revisionable Class Usage Examples

Méthodes publiques

Свойство Type Description
$table string

Protected Properties

Свойство Type Description
$revisionFormattedFields array

Méthodes publiques

Méthode Description
__construct ( array $attributes = [] )
fieldName ( ) : string Field Name
format ( $key, $value ) : string Format the value according to the $revisionFormattedFields array.
historyOf ( ) : Object | false Returns the object we have the history of
newValue ( ) : string New Value.
oldValue ( ) : string Old Value.
revisionable ( ) : array Revisionable.
userResponsible ( ) : User User Responsible.

Private Methods

Méthode Description
formatFieldName ( $key ) : boolean Format field name.
getRelatedModel ( ) : string Return the name of the related model.
getValue ( string $which = 'new' ) : string Responsible for actually doing the grunt work for getting the old or new value for the revision.
isRelated ( ) : boolean Return true if the key is for a related model.

Method Details

__construct() public méthode

public __construct ( array $attributes = [] )
$attributes array

fieldName() public méthode

Returns the field that was updated, in the case that it's a foreign key denoted by a suffix of "_id", then "_id" is simply stripped
public fieldName ( ) : string
Résultat string field

format() public méthode

Format the value according to the $revisionFormattedFields array.
public format ( $key, $value ) : string
$key
$value
Résultat string formatted value

historyOf() public méthode

Returns the object we have the history of
public historyOf ( ) : Object | false
Résultat Object | false

newValue() public méthode

Grab the new value of the field, if it was a foreign key attempt to get an identifying name for the model.
public newValue ( ) : string
Résultat string old value

oldValue() public méthode

Grab the old value of the field, if it was a foreign key attempt to get an identifying name for the model.
public oldValue ( ) : string
Résultat string old value

revisionable() public méthode

Grab the revision history for the model that is calling
public revisionable ( ) : array
Résultat array revision history

userResponsible() public méthode

User Responsible.
public userResponsible ( ) : User
Résultat User user responsible for the change

Property Details

$revisionFormattedFields protected_oe property

protected array $revisionFormattedFields
Résultat array

$table public_oe property

public string $table
Résultat string