Skip to content

Commit

Permalink
Merge pull request #451 from owen-it/feat/move-audit-relation-from-tr…
Browse files Browse the repository at this point in the history
…ait-to-model

[FEAT] Make Auditable/User relation more flexible
  • Loading branch information
quetzyg committed Oct 14, 2018
2 parents 3a5738e + 24f0eb3 commit 0534b09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/Audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Config;
use OwenIt\Auditing\Contracts\AttributeEncoder;

Expand Down Expand Up @@ -59,22 +58,6 @@ public function getTable(): string
return Config::get('audit.drivers.database.table', parent::getTable());
}

/**
* {@inheritdoc}
*/
public function auditable(): MorphTo
{
return $this->morphTo();
}

/**
* {@inheritdoc}
*/
public function user(): MorphTo
{
return $this->morphTo();
}

/**
* {@inheritdoc}
*/
Expand Down
17 changes: 17 additions & 0 deletions src/Models/Audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace OwenIt\Auditing\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;

class Audit extends Model implements \OwenIt\Auditing\Contracts\Audit
{
Expand All @@ -33,4 +34,20 @@ class Audit extends Model implements \OwenIt\Auditing\Contracts\Audit
'new_values' => 'json',
'auditable_id' => 'integer',
];

/**
* {@inheritdoc}
*/
public function auditable(): MorphTo
{
return $this->morphTo();
}

/**
* {@inheritdoc}
*/
public function user(): MorphTo
{
return $this->morphTo();
}
}

0 comments on commit 0534b09

Please sign in to comment.