PHP Class Mpociot\Versionable\Version

Inheritance: extends Illuminate\Database\Eloquent\Model
Show file Open project: mpociot/versionable Class Usage Examples

Public Properties

Property Type Description
$table string

Protected Properties

Property Type Description
$primaryKey string

Public Methods

Method Description
diff ( Version $againstVersion = null ) : array Diff the attributes of this version model against another version.
getModel ( ) : Model Return the versioned model
getResponsibleUserAttribute ( ) : mixed Return the user responsible for this version
revert ( ) : Model Revert to the stored model version make it the current version
versionable ( ) : Illuminate\Database\Eloquent\Relations\MorphTo Sets up the relation

Method Details

diff() public method

If no version is provided, it will be diffed against the current version.
public diff ( Version $againstVersion = null ) : array
$againstVersion Version
return array

getModel() public method

Return the versioned model
public getModel ( ) : Model
return Illuminate\Database\Eloquent\Model

getResponsibleUserAttribute() public method

Return the user responsible for this version

revert() public method

Revert to the stored model version make it the current version
public revert ( ) : Model
return Illuminate\Database\Eloquent\Model

versionable() public method

Sets up the relation
public versionable ( ) : Illuminate\Database\Eloquent\Relations\MorphTo
return Illuminate\Database\Eloquent\Relations\MorphTo

Property Details

$primaryKey protected property

protected string $primaryKey
return string

$table public property

public string $table
return string