PHP Trait OwenIt\Auditing\Auditable

Show file Open project: owen-it/laravel-auditing

Protected Properties

Property Type Description
$auditCurrentUrl string
$auditEvent string
$auditIpAddress string
$auditUserId string
$dirtyData array
$newData array
$oldData array

Public Methods

Method Description
audit ( ) : void Audit the model auditable.
auditCreation ( ) : void Audit creation.
auditDeletion ( ) : void Audit deletion.
auditUpdate ( ) : void Audit updated.
audits ( ) : Illuminate\Database\Eloquent\Relations\MorphMany Auditable Model audits.
bootAuditable ( ) Init auditing.
cleanHiddenAuditAttributes ( array $attributes ) : array Remove the value of attributes which are hidden or not visible on the model.
clearOlderAudits ( )
getAuditableEvents ( ) : array Get the auditable events.
getAuditors ( ) : array Get the Auditors.
getIpAddress ( ) : mixed Get IP Address.
isAuditEnabled ( ) : boolean Determine whether audit enabled.
isAuditRespectsHidden ( ) : boolean Whether to clean the attributes which are hidden or not visible.
isEventAuditable ( string $event ) : boolean Determine whether an event is auditable.
prepareAudit ( ) : void Prepare audit model.
setAuditEvent ( $event ) Set audit event.
toAudit ( ) : array Audit model.
transformAudit ( array $data )

Protected Methods

Method Description
getCurrentUrl ( ) : string Get the current request's route if available.
getLoggedInUserId ( ) : null Get user id.

Private Methods

Method Description
changedAuditingFields ( ) : array Fields Changed.
isAttributeAuditable ( $attribute ) : boolean Determine whether a attribute is auditable for audit manipulation.

Method Details

audit() public method

Audit the model auditable.
public audit ( ) : void
return void

auditCreation() public method

Audit creation.
public auditCreation ( ) : void
return void

auditDeletion() public method

Audit deletion.
public auditDeletion ( ) : void
return void

auditUpdate() public method

Audit updated.
public auditUpdate ( ) : void
return void

audits() public method

Auditable Model audits.
public audits ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
return Illuminate\Database\Eloquent\Relations\MorphMany

bootAuditable() public static method

Init auditing.
public static bootAuditable ( )

cleanHiddenAuditAttributes() public method

Remove the value of attributes which are hidden or not visible on the model.
public cleanHiddenAuditAttributes ( array $attributes ) : array
$attributes array
return array

clearOlderAudits() public method

public clearOlderAudits ( )

getAuditableEvents() public method

Get the auditable events.
public getAuditableEvents ( ) : array
return array

getAuditors() public method

Get the Auditors.
public getAuditors ( ) : array
return array

getCurrentUrl() protected method

Get the current request's route if available.
protected getCurrentUrl ( ) : string
return string

getIpAddress() public method

Get IP Address.
public getIpAddress ( ) : mixed
return mixed

getLoggedInUserId() protected method

Get user id.
protected getLoggedInUserId ( ) : null
return null

isAuditEnabled() public static method

Determine whether audit enabled.
public static isAuditEnabled ( ) : boolean
return boolean

isAuditRespectsHidden() public method

Whether to clean the attributes which are hidden or not visible.
public isAuditRespectsHidden ( ) : boolean
return boolean

isEventAuditable() public method

Determine whether an event is auditable.
public isEventAuditable ( string $event ) : boolean
$event string
return boolean

prepareAudit() public method

Prepare audit model.
public prepareAudit ( ) : void
return void

setAuditEvent() public method

Set audit event.
public setAuditEvent ( $event )

toAudit() public method

Audit model.
public toAudit ( ) : array
return array

transformAudit() public method

public transformAudit ( array $data )
$data array

Property Details

$auditCurrentUrl protected property

protected string $auditCurrentUrl
return string

$auditEvent protected property

protected string $auditEvent
return string

$auditIpAddress protected property

protected string $auditIpAddress
return string

$auditUserId protected property

protected string $auditUserId
return string

$dirtyData protected property

protected array $dirtyData
return array

$newData protected property

protected array $newData
return array

$oldData protected property

protected array $oldData
return array