Add support for tracking when an activity event is triggered from an API key
This commit is contained in:
parent
92c1c162af
commit
0520014c0f
7 changed files with 87 additions and 0 deletions
|
@ -210,6 +210,7 @@ class ActivityLogService
|
|||
'ip' => Request::ip(),
|
||||
'batch_uuid' => $this->batch->uuid(),
|
||||
'properties' => Collection::make([]),
|
||||
'api_key_id' => $this->targetable->apiKeyId(),
|
||||
]);
|
||||
|
||||
if ($subject = $this->targetable->subject()) {
|
||||
|
|
|
@ -10,6 +10,8 @@ class ActivityLogTargetableService
|
|||
|
||||
protected ?Model $subject = null;
|
||||
|
||||
protected ?int $apiKeyId = null;
|
||||
|
||||
public function setActor(Model $actor): void
|
||||
{
|
||||
$this->actor = $actor;
|
||||
|
@ -20,6 +22,11 @@ class ActivityLogTargetableService
|
|||
$this->subject = $subject;
|
||||
}
|
||||
|
||||
public function setApiKeyId(?int $apiKeyId): void
|
||||
{
|
||||
$this->apiKeyId = $apiKeyId;
|
||||
}
|
||||
|
||||
public function actor(): ?Model
|
||||
{
|
||||
return $this->actor;
|
||||
|
@ -30,9 +37,15 @@ class ActivityLogTargetableService
|
|||
return $this->subject;
|
||||
}
|
||||
|
||||
public function apiKeyId(): ?int
|
||||
{
|
||||
return $this->apiKeyId;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->actor = null;
|
||||
$this->subject = null;
|
||||
$this->apiKeyId = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue