*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'action' => $this->action, 'user' => ['id' => $this->user_id, 'name' => $this->user_name], 'via' => $this->via, 'api_token_id' => $this->api_token_id, 'ip' => $this->ip, 'subject' => $this->subject_type ? [ 'type' => $this->subject_type, 'id' => $this->subject_id, 'label' => $this->subject_label, ] : null, 'changes' => $this->changes === null ? null : (object) $this->changes, 'created_at' => $this->created_at?->toIso8601String(), ]; } }