diff --git a/migrations/Version20260624120000.php b/migrations/Version20260624120000.php new file mode 100644 index 0000000..6ea4a9c --- /dev/null +++ b/migrations/Version20260624120000.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE audit_logs ADD ip_address VARCHAR(45) DEFAULT NULL'); + $this->addSql('ALTER TABLE audit_logs ADD user_agent TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE audit_logs ADD device_label VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE audit_logs ADD device_id VARCHAR(64) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE audit_logs DROP COLUMN ip_address'); + $this->addSql('ALTER TABLE audit_logs DROP COLUMN user_agent'); + $this->addSql('ALTER TABLE audit_logs DROP COLUMN device_label'); + $this->addSql('ALTER TABLE audit_logs DROP COLUMN device_id'); + } +} diff --git a/src/Entity/AuditLog.php b/src/Entity/AuditLog.php index 730060d..c6cbee8 100644 --- a/src/Entity/AuditLog.php +++ b/src/Entity/AuditLog.php @@ -46,6 +46,18 @@ class AuditLog #[ORM\Column(type: 'date_immutable', nullable: true)] private ?DateTimeImmutable $affectedDate = null; + #[ORM\Column(type: 'string', length: 45, nullable: true)] + private ?string $ipAddress = null; + + #[ORM\Column(type: 'text', nullable: true)] + private ?string $userAgent = null; + + #[ORM\Column(type: 'string', length: 255, nullable: true)] + private ?string $deviceLabel = null; + + #[ORM\Column(type: 'string', length: 64, nullable: true)] + private ?string $deviceId = null; + #[ORM\Column(type: 'datetime_immutable')] private DateTimeImmutable $createdAt; @@ -155,6 +167,54 @@ class AuditLog return $this; } + public function getIpAddress(): ?string + { + return $this->ipAddress; + } + + public function setIpAddress(?string $ipAddress): self + { + $this->ipAddress = $ipAddress; + + return $this; + } + + public function getUserAgent(): ?string + { + return $this->userAgent; + } + + public function setUserAgent(?string $userAgent): self + { + $this->userAgent = $userAgent; + + return $this; + } + + public function getDeviceLabel(): ?string + { + return $this->deviceLabel; + } + + public function setDeviceLabel(?string $deviceLabel): self + { + $this->deviceLabel = $deviceLabel; + + return $this; + } + + public function getDeviceId(): ?string + { + return $this->deviceId; + } + + public function setDeviceId(?string $deviceId): self + { + $this->deviceId = $deviceId; + + return $this; + } + public function getCreatedAt(): DateTimeImmutable { return $this->createdAt;