Skip to content

Commit 1ec0aab

Browse files
Merge pull request #684 from owen-it/v13-dev
V13 dev
2 parents 98f1cfd + e82bfbe commit 1ec0aab

37 files changed

+715
-164
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
| Bug? | no|yes
44
| New Feature? | no|yes
55
| Framework | Laravel|Lumen
6-
| Framework version | 5.x.y
7-
| Package version | 6.x.y
6+
| Framework version | 8.x.y
7+
| Package version | 12.x.y
88
| PHP version | 7.x.y
99

1010
#### Actual Behaviour

.github/workflows/run-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php: [7.4, 8.0]
16-
laravel: [8.*, 7.*, 6.*, 9.*]
16+
laravel: [ 8.*, 7.*, 9.* ]
1717
include:
1818
- laravel: 9.*
1919
testbench: 7.*
2020
- laravel: 8.*
2121
testbench: 6.*
2222
- laravel: 7.*
2323
testbench: 5.*
24-
- laravel: 6.*
25-
testbench: 4.*
2624
exclude:
2725
- laravel: 9.*
2826
php: 7.4

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1+
## v13.0.0
2+
3+
### Added
4+
5+
- **dynamic resolvers** | Option to add/disable resolvers in config
6+
- Resolvers extend same contract and does not enforce a specific returntype at contract level
7+
- a new "exclude" config key for setting a global default
8+
exclude ([#637](https://github.com/owen-it/laravel-auditing/pull/637))
9+
110
## v12.0.0 (2020-12-02)
11+
212
### Added
13+
314
- PHP 8.0 support
415

516
### Removed
17+
618
- Illuminate 5.8 support
719

820
## v9.0.0 (2019-03-02)
21+
922
### Added
1023
- Illuminate 5.8 support
1124

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ Laravel Auditing allows you to keep a history of model changes by simply using a
2020
The package documentation can be found on the [official website](http://www.laravel-auditing.com) or at the [documentation repository](https://github.com/owen-it/laravel-auditing-doc/blob/master/documentation.md).
2121

2222
## Version Information
23-
Version | Illuminate | Status | PHP Version
23+
24+
Version | Illuminate | Status | PHP Version
2425
:----------|:--------------|:------------------------|:------------
25-
12.x | 6.x.x - 9.x.x | Active support :rocket: | >= 7.3 \| 8.0
26-
11.x | 5.8.x - 8.x.x | Active support | >= 7.3
27-
10.x | 5.8.x - 7.x.x | Active support | >= 7.2.5
28-
9.x | 5.8.x - 6.x.x | Active support | >= 7.1.3
29-
8.x | 5.2.x - 5.7.x | Active support | >= 7.0.13
30-
7.x | 5.2.x - 5.6.x | End of life | >= 7.0.13
31-
6.x | 5.2.x - 5.6.x | End of life | >= 7.0.13
32-
5.x | 5.2.x - 5.5.x | End of life | >= 7.0.13
33-
4.x | 5.2.x - 5.5.x | End of life | >= 5.5.9
34-
3.x | 5.2.x - 5.4.x | End of life | >= 5.5.9
35-
2.x | 5.1.x - 5.3.x | End of life | >= 5.5.9
26+
27+
13.x | 7.x.x - 9.x.x | Active support :rocket: | > = 7.3 \| 8.0
28+
12.x | 6.x.x - 8.x.x | Active support | > = 7.3 \| 8.0
29+
11.x | 5.8.x - 8.x.x | End of life | > = 7.3
30+
10.x | 5.8.x - 7.x.x | End of life | > = 7.2.5
31+
9.x | 5.8.x - 6.x.x | End of life | > = 7.1.3
32+
8.x | 5.2.x - 5.7.x | End of life | > = 7.0.13
33+
7.x | 5.2.x - 5.6.x | End of life | > = 7.0.13
34+
6.x | 5.2.x - 5.6.x | End of life | > = 7.0.13
35+
5.x | 5.2.x - 5.5.x | End of life | > = 7.0.13
36+
4.x | 5.2.x - 5.5.x | End of life | > = 5.5.9
37+
3.x | 5.2.x - 5.4.x | End of life | > = 5.5.9
38+
2.x | 5.1.x - 5.3.x | End of life | > = 5.5.9
3639

3740
## Contributing
3841
Please see the [contributing](http://laravel-auditing.com/docs/master/contributing) entry for more details.

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,23 @@
3232
{
3333
"name": "Raphael França",
3434
"email": "raphaelfrancabsb@gmail.com"
35+
},
36+
{
37+
"name": "Morten D. Hansen",
38+
"email": "morten@visia.dk"
3539
}
3640
],
3741
"require": {
3842
"php": "^7.3|^8.0",
39-
"illuminate/console": "^6.0|^7.0|^8.0|^9.0",
40-
"illuminate/database": "^6.0|^7.0|^8.0|^9.0",
41-
"illuminate/filesystem": "^6.0|^7.0|^8.0|^9.0",
43+
"illuminate/console": "^7.0|^8.0|^9.0",
44+
"illuminate/database": "^7.0|^8.0|^9.0",
45+
"illuminate/filesystem": "^7.0|^8.0|^9.0",
4246
"ext-json": "*"
4347
},
4448
"require-dev": {
4549
"phpunit/phpunit": "^9.0",
4650
"mockery/mockery": "^1.0",
47-
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0",
51+
"orchestra/testbench": "^5.0|^6.0|^7.0",
4852
"laravel/legacy-factories": "*"
4953
},
5054
"autoload": {

config/audit.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
|
2525
*/
2626

27-
'user' => [
27+
'user' => [
2828
'morph_prefix' => 'user',
2929
'guards' => [
3030
'web',
3131
'api',
3232
],
33+
'resolver' => OwenIt\Auditing\Resolvers\UserResolver::class
3334
],
3435

3536
/*
@@ -40,8 +41,7 @@
4041
| Define the User, IP Address, User Agent and URL resolver implementations.
4142
|
4243
*/
43-
'resolver' => [
44-
'user' => OwenIt\Auditing\Resolvers\UserResolver::class,
44+
'resolvers' => [
4545
'ip_address' => OwenIt\Auditing\Resolvers\IpAddressResolver::class,
4646
'user_agent' => OwenIt\Auditing\Resolvers\UserAgentResolver::class,
4747
'url' => OwenIt\Auditing\Resolvers\UrlResolver::class,
@@ -60,7 +60,7 @@
6060
'created',
6161
'updated',
6262
'deleted',
63-
'restored',
63+
'restored'
6464
],
6565

6666
/*
@@ -74,6 +74,37 @@
7474

7575
'strict' => false,
7676

77+
/*
78+
|--------------------------------------------------------------------------
79+
| Global exclude
80+
|--------------------------------------------------------------------------
81+
|
82+
| Have something you always want to exclude by default? - add it here.
83+
| Note that this is overwritten (not merged) with local exclude
84+
|
85+
*/
86+
87+
'exclude' => [],
88+
89+
/*
90+
|--------------------------------------------------------------------------
91+
| Empty Values
92+
|--------------------------------------------------------------------------
93+
|
94+
| Should Audit records be stored when the recorded old_values & new_values
95+
| are both empty?
96+
|
97+
| Some events may be empty on purpose. Use allowed_empty_values to exclude
98+
| those from the empty values check. For example when auditing
99+
| model retrieved events which will never have new and old values
100+
|
101+
*/
102+
103+
'empty_values' => true,
104+
'allowed_empty_values' => [
105+
'retrieved'
106+
],
107+
77108
/*
78109
|--------------------------------------------------------------------------
79110
| Audit Timestamps

src/Audit.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,20 @@ public function resolveData(): array
7474
$this->data = [
7575
'audit_id' => $this->id,
7676
'audit_event' => $this->event,
77-
'audit_url' => $this->url,
78-
'audit_ip_address' => $this->ip_address,
79-
'audit_user_agent' => $this->user_agent,
8077
'audit_tags' => $this->tags,
8178
'audit_created_at' => $this->serializeDate($this->created_at),
8279
'audit_updated_at' => $this->serializeDate($this->updated_at),
8380
'user_id' => $this->getAttribute($morphPrefix . '_id'),
8481
'user_type' => $this->getAttribute($morphPrefix . '_type'),
8582
];
8683

84+
// add resolvers data to metadata
85+
$resolverData = [];
86+
foreach (array_keys(Config::get('audit.resolvers', [])) as $name) {
87+
$resolverData['audit_' . $name] = $this->$name;
88+
}
89+
$this->data = array_merge($this->data, $resolverData);
90+
8791
if ($this->user) {
8892
foreach ($this->user->getArrayableAttributes() as $attribute => $value) {
8993
$this->data['user_' . $attribute] = $value;

0 commit comments

Comments
 (0)