Skip to content

Commit

Permalink
Added default auditor
Browse files Browse the repository at this point in the history
  • Loading branch information
anteriovieira committed Sep 25, 2016
1 parent 61efd30 commit 13131a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 11 additions & 0 deletions config/auditing.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,15 @@
*/

'audit_console' => false,

/*
|--------------------------------------------------------------------------
| Default Auditor
|--------------------------------------------------------------------------
|
| The default auditor used to audit model.
|
*/

'default_auditor' => 'database',
];
8 changes: 2 additions & 6 deletions src/Auditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

namespace OwenIt\Auditing;

use Illuminate\Support\Facades\Config;
use OwenIt\Auditing\Contracts\Dispatcher;

trait Auditor
{
/**
* @var array
*/
protected $auditorsDefaults = ['database'];

/**
* Audit the given information.
*
Expand All @@ -28,6 +24,6 @@ public function audit()
*/
public function getAuditors()
{
return isset($this->auditors) ? (array) $this->auditors : $this->auditorsDefaults;
return isset($this->auditors) ? (array) $this->auditors : Config::get('auditing.default_auditor');
}
}
2 changes: 1 addition & 1 deletion src/AuditorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace OwenIt\Auditing;

use Illuminate\Support\Manager;
use InvalidArgumentException;
use Illuminate\Support\Manager;
use OwenIt\Auditing\Contracts\Dispatcher;

class AuditorManager extends Manager implements Dispatcher
Expand Down

0 comments on commit 13131a1

Please sign in to comment.