Skip to content

Commit 2db65b2

Browse files
author
Andreas Aagaard
committed
# Initial
1 parent 1613e97 commit 2db65b2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/ActivityLogger.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function withProperty(string $key, $value)
107107

108108
public function createdAt(Carbon $dateTime)
109109
{
110-
$this->getActivity()->created_at = $dateTime;
110+
$this->getActivity()->created = $dateTime;
111111

112112
return $this;
113113
}

src/Models/Activity.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function subject(): MorphTo
3636
return $this->morphTo()->withTrashed();
3737
}
3838

39-
return $this->morphTo();
39+
return $this->morphTo('subject', 'subjectType', 'subjectID', 'subjectID');
4040
}
4141

4242
public function causer(): MorphTo
@@ -85,4 +85,7 @@ public function scopeForSubject(Builder $query, Model $subject): Builder
8585
->where('subjectType', $subject->getMorphClass())
8686
->where('subjectID', $subject->getKey());
8787
}
88+
89+
const CREATED_AT = 'created';
90+
const UPDATED_AT = 'updated';
8891
}

src/Traits/LogsActivity.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ protected function shouldLogEvent(string $eventName): bool
139139
return true;
140140
}
141141

142-
if (Arr::has($this->getDirty(), 'deleted_at')) {
143-
if ($this->getDirty()['deleted_at'] === null) {
142+
if (Arr::has($this->getDirty(), 'deleted')) {
143+
if ($this->getDirty()['deleted'] === null) {
144144
return false;
145145
}
146146
}

0 commit comments

Comments
 (0)