Skip to content

Commit df95425

Browse files
committed
Always access the activity through the getActivity method
1 parent f957c57 commit df95425

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ActivityLogger.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ public function by(Model | int | string | null $modelOrId): static
7777

7878
public function causedByAnonymous(): static
7979
{
80-
$this->activity->causer_id = null;
81-
$this->activity->causer_type = null;
80+
$activity = $this->getActivity();
81+
82+
$activity->causer_id = null;
83+
$activity->causer_type = null;
8284

8385
return $this;
8486
}
@@ -95,7 +97,7 @@ public function event(string $event): static
9597

9698
public function setEvent(string $event): static
9799
{
98-
$this->activity->event = $event;
100+
$this->getActivity()->event = $event;
99101

100102
return $this;
101103
}
@@ -160,7 +162,7 @@ public function log(string $description): ?ActivityContract
160162
return null;
161163
}
162164

163-
$activity = $this->activity;
165+
$activity = $this->getActivity();
164166

165167
$activity->description = $this->replacePlaceholders(
166168
$activity->description ?? $description,

0 commit comments

Comments
 (0)