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
显示文件 Open project: venturecraft/revisionable Class Usage Examples

Public Properties

Property Type Description
$table string

Protected Properties

Property Type Description
$revisionFormattedFields array

Public Methods

Method 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

Method 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 method

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

fieldName() public method

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
return string field

format() public method

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

historyOf() public method

Returns the object we have the history of
public historyOf ( ) : Object | false
return Object | false

newValue() public method

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
return string old value

oldValue() public method

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
return string old value

revisionable() public method

Grab the revision history for the model that is calling
public revisionable ( ) : array
return array revision history

userResponsible() public method

User Responsible.
public userResponsible ( ) : User
return User user responsible for the change

Property Details

$revisionFormattedFields protected_oe property

protected array $revisionFormattedFields
return array

$table public_oe property

public string $table
return string