'array', 'created_at' => 'datetime', ]; } public function project(): BelongsTo { return $this->belongsTo(Project::class); } public function actor(): BelongsTo { return $this->belongsTo(User::class, 'actor_id'); } public static function record(int $projectId, string $eventType, ?int $actorId, ?string $subjectType = null, ?int $subjectId = null, array $metadata = []): self { return self::create([ 'project_id' => $projectId, 'event_type' => $eventType, 'actor_id' => $actorId, 'subject_type' => $subjectType, 'subject_id' => $subjectId, 'metadata' => $metadata, 'created_at' => now(), ]); } }