sha1((string) $model->id), 'batch' => $model->batch, 'event' => $model->event, 'is_api' => !is_null($model->api_key_id), 'ip' => $this->canViewIP($model->actor) ? $model->ip : null, 'description' => $model->description, 'properties' => $model->wrapProperties(), 'has_additional_metadata' => $model->hasAdditionalMetadata(), 'timestamp' => $model->timestamp->toAtomString(), ]; } public function includeActor(ActivityLog $model): ResourceAbstract { if (!$model->actor instanceof User) { return $this->null(); } return $this->item($model->actor, $this->makeTransformer(UserTransformer::class), User::RESOURCE_NAME); } /** * Determines if the user can view the IP address in the output either because they are the * actor that performed the action, or because they are an administrator on the Panel. */ protected function canViewIP(?Model $actor = null): bool { return $actor?->is($this->request->user()) || $this->request->user()->can('seeIps activityLog'); } }