/
Auditable.php
131 lines (113 loc) · 2.54 KB
/
Auditable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
namespace OwenIt\Auditing\Contracts;
use Illuminate\Database\Eloquent\Relations\MorphMany;
interface Auditable
{
/**
* Auditable Model audits.
*
* @return MorphMany<\OwenIt\Auditing\Models\Audit>
*/
public function audits(): MorphMany;
/**
* Set the Audit event.
*
* @param string $event
*
* @return Auditable
*/
public function setAuditEvent(string $event): Auditable;
/**
* Get the Audit event that is set.
*
* @return string|null
*/
public function getAuditEvent();
/**
* Get the events that trigger an Audit.
*
* @return array
*/
public function getAuditEvents(): array;
/**
* Is the model ready for auditing?
*
* @return bool
*/
public function readyForAuditing(): bool;
/**
* Return data for an Audit.
*
* @throws \OwenIt\Auditing\Exceptions\AuditingException
*
* @return array
*/
public function toAudit(): array;
/**
* Get the (Auditable) attributes included in audit.
*
* @return array
*/
public function getAuditInclude(): array;
/**
* Get the (Auditable) attributes excluded from audit.
*
* @return array
*/
public function getAuditExclude(): array;
/**
* Get the strict audit status.
*
* @return bool
*/
public function getAuditStrict(): bool;
/**
* Get the audit (Auditable) timestamps status.
*
* @return bool
*/
public function getAuditTimestamps(): bool;
/**
* Get the Audit Driver.
*
* @return string|null
*/
public function getAuditDriver();
/**
* Get the Audit threshold.
*
* @return int
*/
public function getAuditThreshold(): int;
/**
* Get the Attribute modifiers.
*
* @return array
*/
public function getAttributeModifiers(): array;
/**
* Transform the data before performing an audit.
*
* @param array $data
*
* @return array
*/
public function transformAudit(array $data): array;
/**
* Generate an array with the model tags.
*
* @return array
*/
public function generateTags(): array;
/**
* Transition to another model state from an Audit.
*
* @param Audit $audit
* @param bool $old
*
* @throws \OwenIt\Auditing\Exceptions\AuditableTransitionException
*
* @return Auditable
*/
public function transitionTo(Audit $audit, bool $old = false): Auditable;
}