Skip to content

Commit b7174f4

Browse files
committed
Clean up docs, structure
1 parent 48797d0 commit b7174f4

5 files changed

Lines changed: 14 additions & 26 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Tatter Software
3+
Copyright (c) 2019-2020 Tatter Software
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Lightweight object logging for CodeIgniter 4
66
1. Install with Composer: `> composer require tatter/audits`
77
2. Update the database: `> php spark migrate -all`
88
3. Setup your models:
9+
910
```
1011
class JobModel extends Model
1112
{
@@ -14,7 +15,7 @@ class JobModel extends Model
1415
protected $afterUpdate = ['auditUpdate'];
1516
protected $afterDelete = ['auditDelete'];
1617
```
17-
4. All done!
18+
1819

1920
## Features
2021

@@ -33,45 +34,35 @@ Once the files are downloaded and included in the autoload, run any library migr
3334
to ensure the database is setup correctly:
3435
* `> php spark migrate -all`
3536

36-
**Pro Tip:** You can add the spark command to your composer.json to ensure your database is
37-
always current with the latest release:
38-
```
39-
{
40-
...
41-
"scripts": {
42-
"post-update-cmd": [
43-
"composer dump-autoload",
44-
"php spark migrate -all"
45-
]
46-
},
47-
...
48-
```
49-
5037
## Configuration (optional)
5138

5239
The library's default behavior can be altered by extending its config file. Copy
53-
**bin/Audits.php** to **app/Config/Audits.php** and follow the instructions in the
40+
**examples/Audits.php** to **app/Config/Audits.php** and follow the instructions in the
5441
comments. If no config file is found in **app/Config** the library will use its own.
5542

5643
## Usage
5744

5845
Once the library is included all the resources are ready to go and you just need to
5946
specify which models and events to audit. Use AuditsTrait to add support to any models
6047
you would like tracked:
48+
6149
```
6250
class JobModel extends Model
6351
{
6452
use \Tatter\Audits\Traits\AuditsTrait;
6553
```
54+
6655
Then specify which events you want audited by assigning the corresponding audit methods
6756
for those events:
57+
6858
```
6959
protected $afterInsert = ['auditInsert'];
7060
protected $afterUpdate = ['auditUpdate'];
7161
protected $afterDelete = ['auditDelete'];
7262
```
7363

7464
The Audits library will create basic logs of each event in the `audits` table, for example:
65+
7566
```
7667
| id | source | source_id | user_id | event | summary | created_at |
7768
+----+--------+-----------+---------+--------+----------+---------------------+

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020
],
2121
"require": {
22-
"php" : "^7.0"
22+
"php" : ">=7.2"
2323
},
2424
"require-dev": {
2525
"codeigniter4/framework": "dev-master"
@@ -31,8 +31,7 @@
3131
},
3232
"scripts": {
3333
"post-update-cmd": [
34-
"composer dump-autoload",
35-
"php spark migrate:latest -n all"
34+
"composer dump-autoload"
3635
]
3736
}
3837
}

bin/Audits.php renamed to examples/Audits.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
*
1111
***/
1212

13-
use CodeIgniter\Config\BaseConfig;
14-
1513
class Audits extends \Tatter\Audits\Config\Audits
1614
{
17-
// key in $_SESSION that contains the integer ID of a logged in user
15+
// Session key in that contains the integer ID of a logged in user
1816
public $sessionUserId = "logged_in";
1917

20-
// whether to continue instead of throwing exceptions
18+
// Whether to continue instead of throwing exceptions
2119
public $silent = true;
2220
}

src/Config/Audits.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
class Audits extends BaseConfig
66
{
7-
// key in $_SESSION that contains the integer ID of a logged in user
7+
// Session key in that contains the integer ID of a logged in user
88
public $sessionUserId = "logged_in";
99

10-
// whether to continue instead of throwing exceptions
10+
// Whether to continue instead of throwing exceptions
1111
public $silent = true;
1212
}

0 commit comments

Comments
 (0)