'array', 'created_at' => 'datetime', ]; } public function organization(): BelongsTo { return $this->belongsTo(Organization::class, 'organization_id'); } public static function record( string $ownerRef, string $action, ?int $organizationId = null, ?string $actorRef = null, ?string $subjectType = null, ?int $subjectId = null, ?array $metadata = null, ): self { return static::create([ 'owner_ref' => $ownerRef, 'organization_id' => $organizationId, 'actor_ref' => $actorRef, 'action' => $action, 'subject_type' => $subjectType, 'subject_id' => $subjectId, 'metadata' => $metadata, 'ip_address' => request()?->ip(), 'created_at' => now(), ]); } }