From d1f8a2ef53dff0f0e7840bd4e99a524180f9ed64 Mon Sep 17 00:00:00 2001 From: Masroor Ehsan Date: Mon, 30 Dec 2024 22:15:59 +0600 Subject: [PATCH] wip --- app/Services/AuditTrail/ActivityLogger.php | 8 ++++---- app/Services/AuditTrail/Category.php | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Services/AuditTrail/ActivityLogger.php b/app/Services/AuditTrail/ActivityLogger.php index 5e3861a..60c5268 100644 --- a/app/Services/AuditTrail/ActivityLogger.php +++ b/app/Services/AuditTrail/ActivityLogger.php @@ -27,14 +27,14 @@ public function __construct() $this->category = Category::GENERAL; } - public function performedOn(Study $study): static + public function on(Study $study): static { $this->studyId = $study->id; return $this; } - public function causedBy(Authenticatable|int $user): static + public function by(Authenticatable|int $user): static { if ($user == null) { return $this; @@ -77,9 +77,9 @@ public function notes(string $notes): static return $this; } - public function withAgent(): static + public function ua(?string $agent = null): static { - $this->userAgent = request()->userAgent(); + $this->userAgent = $agent ?? request()->userAgent(); return $this; } diff --git a/app/Services/AuditTrail/Category.php b/app/Services/AuditTrail/Category.php index 9e50c4a..7bbaad1 100644 --- a/app/Services/AuditTrail/Category.php +++ b/app/Services/AuditTrail/Category.php @@ -4,5 +4,11 @@ final class Category { - public const int GENERAL = 1; + public const int GENERAL = 10; + + public const int SYSTEM = 20; + + public const int PACS = 30; + + public const int AUTH = 40; }